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

namespace ConsoleApp17
{
    class Program
    {
        static void Main(string[] args)
        {
            int temp=0,T,p,q,r;
            long L, R, N,y,v1,v2,v3,moguce=0,inte = 1,za=0;
            string[] ulaz = Console.ReadLine().Split(' ');
            p = Convert.ToInt32(ulaz[0]);
            q = Convert.ToInt32(ulaz[1]);
            r = Convert.ToInt32(ulaz[2]);
            L = Convert.ToInt64(ulaz[3]);
            R = Convert.ToInt64(ulaz[4]);
            T = p * q * r;
            N = L;

            inte = (long)Math.Ceiling((double)N / T);

            
            

            while (N <= T * inte)
            {
                za++;
                v1 = (long)Math.Ceiling((double)N / p);
                v2 = (long)Math.Ceiling((double)N / q);
                v3 = (long)Math.Ceiling((double)N / r);
                
                y = v1 + v2 + v3;
                if (N >= y)
                {
                    moguce++;

                }
                
                if (N == R)
                {
                    break;
                }
                N++;
            }
            inte++;
            if (N == R)
            {
                Console.WriteLine("{0}", moguce);
            }
            while (N <= R)
            {
                while (N <= T*inte)
                {
                    za++;
                    v1 = (long)Math.Ceiling((double)N / p);
                    v2 = (long)Math.Ceiling((double)N / q);
                    v3 = (long)Math.Ceiling((double)N / r);
                    y = v1 + v2 + v3;
                    if (y<=N)
                    {
                        temp++;
                        moguce++;
                    }
                    
                    if (N==R)
                    {
                        break;
                    }
                    N++;
                }
                if (temp==0)
                {
                    Console.WriteLine("{0}", moguce);
                    break;
                }
                if (temp==T)
                {
                    moguce =moguce+R-T*inte;
                    Console.WriteLine("{0}", moguce);
                    break;
                }
                temp = 0;
                inte++;
            }
        }
    }
}