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

namespace ConsoleApplication36
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            double p = Convert.ToDouble(s[0]);
            double q = Convert.ToDouble(s[1]);
            double r = Convert.ToDouble(s[2]);
            long L = Convert.ToInt64(s[3]);
            long R = Convert.ToInt64(s[4]);
            long c = 0;
            double z = 0;
            bool key = true;
           
            if (p == 1 || q == 1 || r == 1)
            {
                c = 0;
                key = false;
            }
            if (p + q + r <= 10)
            {
                c = 0;
                key = false;
                if (p == 3 && q == 3 && r == 3) key = true;
            }
            if (key)
            {
                for (double i = L; i <= R; i++)
                {
                    z = 0;
                    z = Math.Ceiling(i / q) + Math.Ceiling(i / r) + Math.Ceiling(i / p);
                    if (z <= i) c++;
                }
            }
            Console.WriteLine(c.ToString());

        }
    }
}