using System;

namespace Permutacije
{
    class Program
    {
       
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            Int64 p = Int64.Parse(input.Split(' ')[0]);
            Int64 q = Int64.Parse(input.Split(' ')[1]);
            Int64 r = Int64.Parse(input.Split(' ')[2]);
            Int64 L = Int64.Parse(input.Split(' ')[3]);
            Int64 R = Int64.Parse(input.Split(' ')[4]);
            Int64 counter = 0;
            for (Int64 i = L; i <= R; i++)
            {
                Int64 N = i;
                Int64 help1;
                Int64 help2;
                Int64 help3;
                if (N % p > 0) help1 = N / p + 1;
                else help1 = N / p;
                if (N % q > 0) help2 = N / q + 1;
                else help2 = N / q;
                if (N % r > 0) help3 = N / r + 1;
                else help3 = N / r;
                if (help1 + help2 + help3 <= N) counter++;



            }
            Console.WriteLine(counter);
            Console.Read();

        }
    }
}