#include <iostream>
#include <cmath>

using namespace std;


int main()
{
	unsigned int p = 0, q = 0, r = 0;
	unsigned long long L = 0, R = 0;

	cin >> p >> q >> r >> L >> R;

	unsigned long long count = 0;
	int sum = 0;
	double Np = 0., Nq = 0., Nr = 0.;

	unsigned int uzastopno = 0;

	for (unsigned long long i = L; i <= R; ++i)
	{
		Np = ceil(i / (double)p);
		Nq = ceil(i / (double)q);
		Nr = ceil(i / (double)r);

		sum = Np + Nq + Nr;
		if (sum <= i)
		{
			++count;
			++uzastopno;

			if (uzastopno == 1000000)
			{
				count = count + (R - i);
				break;
			}
		}
		else
		{
			uzastopno = 0;
		}
	}

	cout << count;

	return 0;
}