using System;

namespace drugelubenice
{
    class Program
    {
        static long lubenice(int a, int b, int c, long l, long r)
        {
            if (l > r)
                return 0;
            double x = l / a;
            x = Math.Ceiling(x);
            double y = l / b;
            y = Math.Ceiling(y);
            double z = l / c;
            z = Math.Ceiling(z);
            if ((x + y + z) <= l)
                return 1 + lubenice(a, b, c, l + 1, r);
            return 0 + lubenice(a, b, c, l + 1, r);

        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine(); // UCITAVA
            int g = s.IndexOf(" ");
            int a = int.Parse(s.Substring(0, g));
            s = s.Remove(0, g + 1);
            g = s.IndexOf(" ");
            int b = int.Parse(s.Substring(0, g));
            s = s.Remove(0, g + 1);
            g = s.IndexOf(" ");
            int c = int.Parse(s.Substring(0, g));
            s = s.Remove(0, g + 1);
            g = s.IndexOf(" ");
            long l = Convert.ToInt64(s.Substring(0, g));
            long r = Convert.ToInt64(s.Substring(g + 1)); // UCITAVA

            long br = lubenice(a, b, c, l, r);
            Console.WriteLine(br);