using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split();
			int p = int.Parse(s[0]), q = int.Parse(s[1]), r = int.Parse(s[2]);
			long leva = long.Parse(s[3]), desna = long.Parse(s[4]), d, br = 0;
			if (desna < p * q * r + 1)
			{
				for (long i = leva; i <= desna; i++)
				{
					d = 0;
					if (i % p == 0)
						d += (long)(i / p);
					else
						d += i / p + 1;
					if (i % q == 0)
						d += i / q;
					else
						d += i / q + 1;
					if (i % r == 0)
						d += i / r;
					else
						d += i / r + 1;
					if (d <= i)
						br++;
				}
			}
			else if (leva > p * q * r + 1)
			{
				br = desna - leva;
			}
			else if (leva < p * q * r + 1 && desna > p * q * r + 1)
			{
				for (long i = leva; i <= p * q * r + 1; i++)
				{
					d = 0;
					if (i % p == 0)
						d += (long)(i / p);
					else
						d += i / p + 1;
					if (i % q == 0)
						d += i / q;
					else
						d += i / q + 1;
					if (i % r == 0)
						d += i / r;
					else
						d += i / r + 1;
					if (d <= i)
						br++;
				}
				br += desna - (p * q * r + 1);
			}
			Console.WriteLine(br);
			
		}
	}
}