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

namespace Zad2T
{
    class Program
    {
        static float Round(float n)
        {
            if (n > (float)(int)n)
            {
                return (float)(int)n + 1.0f;
            }
            else
            {
                return (float)(int)n;
            }
        }
        static void Main(string[] args)
        {
            int p, q, r, limit, L, i;
            long solution, R;
            int n = 0; // broj kombinacija
            float N1 = 0; // 
            //Stopwatch sw = new Stopwatch();

            string input = Console.ReadLine();
            //sw.Start();
            string[] input_str_arr = input.Split(' ');

            p = int.Parse(input_str_arr[0]);
            q = int.Parse(input_str_arr[1]);
            r = int.Parse(input_str_arr[2]);
            L = int.Parse(input_str_arr[3]);
            R = Convert.ToInt64(input_str_arr[4]);
            
            if (R > 100000)
            {
                limit = 100000;
            }else
            {
                limit = (int)R;
            }

            for (i = L; i <= limit ; i++)
            {
                N1 = Round((float)i / (float)p) + Round((float)i / (float)q) + Round((float)i / (float)r);
                if (N1 <= i)
                {
                   //n++;
                   
                }
                else
                {
                    
                    n++;
                    
                }
                
            }
            solution = R - L + 1 - n;
            Console.WriteLine(solution);
            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds + "ms");
            Console.ReadLine();
        }
    }
}