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

namespace Lubenice
{
    class Dinnye
    {
        public ulong c;
        public ulong a;
        public ulong b;
        public ulong min;
        public ulong max;
        public ulong temp;
        public ulong valasz;
        public double x, y;
        public ulong i;
        public ulong van = 0;
        public ulong nincs = 0;
        public ulong szam1, szam2, szam3;
        public Dinnye(ulong p, ulong q, ulong r, ulong L, ulong R)
        {
            a = p;
            b = q;
            c = r;
            min = L;
            max = R;
            Sort();
        }

        public void Test()
        {
            if (a == 2)
            {
                if (b == 3)
                {
                    if (c == 6) Kivetel(6);
                    else if (c > 6) Szamolas();
                    else Nulla();
                }
                else if (b == 4)
                {
                    if (c == 4) Kivetel(4);
                    else if (c > 4) Szamolas();
                    else Nulla();
                }
                else if (b > 4) Szamolas();
                else Nulla();
            }
            else if (a == 3)
            {
                if (b == 3)
                {
                    if (c == 3) Kivetel(3);
                    else if (c > 3) Szamolas();
                    else Nulla();
                }
                else if (b > 3) Szamolas();
                else Nulla();
            }
            else if (a > 3) Szamolas();
            else Nulla();
        }

        public void Kivetel(ulong szam4)
        {
            if (max > 100)
            {
                if (min < 100)
                {
                    Kereses(min, 100);
                    valasz = ((max - 100) / szam4) + van;
                }
                else
                {
                    valasz = (max + 1 - min) / szam4;
                }
            }
            else
            {
                Kereses(min, max);
                valasz = van;
            }
        }

        public void Szamolas()
        {
            if (max < 100)
            {
                Kereses(min, max);
                valasz = van;
            }
            else {
                if (min > 100) valasz = max - min +1;
                else
                {
                    Kereses(min, 100);
                    valasz = max - min + 1 - nincs;
                }
            }
        }


        public void Nulla()
        {
            valasz = 0;
        }

        public void Kereses(ulong Min, ulong Max)
        {
            for (i = Min; i <= Max; i++)
            {
                x = i;

                if (i % a == 0) szam1 = i / a;
                else
                {
                    y = a;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam1 = (ulong)y;
                    //Console.WriteLine($"{szam1}");
                }


                if (i % b == 0) szam2 = i / b;
                else
                {
                    y = b;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam2 = (ulong)y;
                    //Console.WriteLine($"{szam2}");
                }

                if (i % c == 0) szam3 = i / c;
                else
                {
                    y = c;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam3 = (ulong)y;
                    //Console.WriteLine($"{szam3}");
                }

                if ((szam1 + szam2 + szam3) <= i)
                {
                    van++;
                    
                }
                else nincs++;
            }
        }

        public void Eredmeny()
        {
            Console.WriteLine(valasz);
        }

        public void Sort()
        {
            if (a < b)
            {
                if (b > c)
                {
                    temp = c; c = b; b = temp;
                }
            }
            else if (a > b)
            {
                if (b > c)
                {
                    temp = c; c = a; a = temp;
                }
                else if( b < c) 
                {
                    if(c > a)
                    {
                        temp = a; a = b; b = temp;
                    }
                    else
                    {
                        temp = a; a = b; b = c; c = temp;
                    }
                }
                else
                {
                    c = a; a = b;
                }
            }
            else
            {
                if (a > c)
                {
                    a = c; c = b;
                }
            }
            
            //Console.WriteLine($"{a}{b}{c}");
        }


        public void Szamitas()
        {
            /*for (i = L; i <= R; i++)
            {
                x = i;

                if (i % p == 0) szam1 = i / p;
                else
                {
                    y = p;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam1 = (ulong)y;
                    //Console.WriteLine($"{szam1}");
                }


                if (i % q == 0) szam2 = i / q;
                else
                {
                    y = q;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam2 = (ulong)y;
                    //Console.WriteLine($"{szam2}");
                }


                if (i % r == 0) szam3 = i / r;
                else
                {
                    y = r;
                    y = x / y;
                    y = Math.Ceiling(y);
                    szam3 = (ulong)y;
                    //Console.WriteLine($"{szam3}");
                }

                if ((szam1 + szam2 + szam3) <= i)
                {
                    N++;
                }
            }*/
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            //valtozok letrehozasa
            ulong L, R, p, q,r;
            
            //Elso sor beolvasasa
            string[] input = Console.ReadLine().Split(' ');

            //Ertekadas
            p = ulong.Parse(input[0]);
            q = ulong.Parse(input[1]);
            r = ulong.Parse(input[2]);
            L = ulong.Parse(input[3]);
            R = ulong.Parse(input[4]);

            Dinnye dinnye = new Dinnye(p, q, r, L, R);

            dinnye.Test();
            dinnye.Eredmeny();
            
        }
    }
}