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[] str = Console.ReadLine().Split();
            int p = int.Parse(str[0]);
            int q = int.Parse(str[1]);
            int r = int.Parse(str[2]);
            long L = long.Parse(str[3]);
            long R = long.Parse(str[4]);
            long brojevi = 0;
            for (long i = L; i <= R; i++)
            {
                double k = (double)i / p;
                double k1 = (double)i / q;
                double k2 = (double)i / r;
                k = Math.Ceiling(k);
                k1 = Math.Ceiling(k1);
                k2 = Math.Ceiling(k2);
                double zbir = k + k1 + k2;
                if (zbir <= i) brojevi++;
            }
            Console.WriteLine(brojevi);

        }
    }
}