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

namespace Zadatak_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = new string[5];

            unos = Console.ReadLine().Split(' ');

            short p = Convert.ToInt16(unos[0]);
            short q = Convert.ToInt16(unos[1]);
            short r = Convert.ToInt16(unos[2]);
            long L = Convert.ToInt64(unos[3]);
            long R = Convert.ToInt64(unos[4]);
            long brojac = 0;
            long rez1;
            long rez2;
            long rez3;

            if (L <= R)
            {
                for (long i = L; i <= R; i++)
                {
                    int br = 0;

                    if (i % p != 0)
                    {
                        br++;
                    }

                    if (i % q != 0)
                    {
                        br++;
                    }

                    if (i % r != 0)
                    {
                        br++;
                    }

                    rez1 = i / p;
                    rez2 = i / q;
                    rez3 = i / r;

                    if ((rez1 + rez2 + rez3 + br) <= i)
                    {
                        brojac++;
                    }
                }
            }

            else
            {
                for (long i = R; i <= L; i++)
                {
                    long br = 0;

                    if (i % p != 0)
                    {
                        br++;
                    }

                    if (i % q != 0)
                    {
                        br++;
                    }

                    if (i % r != 0)
                    {
                        br++;
                    }

                    rez1 = i / p;
                    rez2 = i / q;
                    rez3 = i / r;

                    if ((rez1 + rez2 + rez3 + br) <= i)
                    {
                        brojac++;
                    }
                }
            }

            Console.WriteLine(brojac);
        }
    }
}