using System;

namespace Zadatak2Takm3
{
    class Program
    {
        static void Main(string[] args)
        {
            long p, q, r, lmax, rmax;
            string[] s = Console.ReadLine().Split();
            p = long.Parse(s[0]);
            q = long.Parse(s[1]);
            r = long.Parse(s[2]);
            lmax = long.Parse(s[3]);
            rmax = long.Parse(s[4]);
            long brojac = 0;
            decimal n = lmax;
            long br = 0, brp = 0, brq = 0, brr = 0;
            if (p == 2 || q == 2 || r == 2 || (p == 3 && q == 3) || (p == 3 && r == 3) || (r == 3 && q == 3))
                for (int i = 0; i < rmax - lmax + 1; i++)
                {
                    brp = (long)Math.Ceiling(n / p);
                    brq = (long)Math.Ceiling(n / q);
                    brr = (long)Math.Ceiling(n / r);
                    br = brp + brq + brr;
                    if (br <= n)
                    {
                        brojac++;
                    }
                    n++;
                }
            else
            {
                if (lmax == 1)
                    brojac = rmax - 2;
                else if (lmax == 2)
                    brojac = rmax - 2;
                else brojac = rmax - lmax + 1;
            }
            Console.WriteLine(brojac);
        }
    }
}