//Failure will never overtake me if my determination to succeed is strong enough
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    long long range[3], l, r;
    cin >> range[0] >> range[1] >> range[2] >> l >> r;

    if(r-l <= 1000000)
    {
        long long rez = 0;

        for(int i = l; i <= r; i++)
        if(ceil(i*1.0/range[0])+ceil(i*1.0/range[1])+ceil(i*1.0/range[2]) <= i)
        {
            rez++;
        }

        cout << rez;
    }

    else
    {
        sort(range, range+3);

        if(range[0] == 2 && range[1] == 3 && range[2] == 6)
        {
            int dodaj = 0;
            if(ceil(r*1.0/range[0])+ceil(r*1.0/range[1])+ceil(r*1.0/range[2]) <= r)
            {
                dodaj++;
            }

            if(ceil(l*1.0/range[0])+ceil(l*1.0/range[1])+ceil(l*1.0/range[2]) <= l)
            {
                dodaj++;
            }


            cout << (r-l+1)/6+dodaj;
            return 0;
        }

        if(range[0] == 2 && range[1] == 4 && range[2] == 4)
        {
            int dodaj = 0;
            if(ceil(r*1.0/range[0])+ceil(r*1.0/range[1])+ceil(r*1.0/range[2]) <= r)
            {
                dodaj++;
            }

            if(ceil(l*1.0/range[0])+ceil(l*1.0/range[1])+ceil(l*1.0/range[2]) <= l)
            {
                dodaj++;
            }

            cout << (r-l+1)/4+dodaj;
            return 0;
        }

        if(range[0] == 3 && range[1] == 3 && range[2] == 3)
        {
            int dodaj = 0;
            if(ceil(r*1.0/range[0])+ceil(r*1.0/range[1])+ceil(r*1.0/range[2]) <= r)
            {
                dodaj++;
            }

            if(ceil(l*1.0/range[0])+ceil(l*1.0/range[1])+ceil(l*1.0/range[2]) <= l)
            {
                dodaj++;
            }

            cout << (r-l+1)/3+dodaj;
            return 0;
        }

        long long rez = 0;
        for(long long i = 1; i <= 1000; i++)
        {
            if(ceil(i*1.0/range[0])+ceil(i*1.0/range[1])+ceil(i*1.0/range[2]) <= i)
            {
                rez++;
            }
        }

        //cout << rez <<endl;

        if(rez == 0)
        {
            cout << 0;
            return 0;
        }


        if(l > 1000)
            cout << r-l+1;

        else
        {
            rez = 0;
            for(int i = l; i <= min(1000LL, r); i++)
            if(ceil(i*1.0/range[0])+ceil(i*1.0/range[1])+ceil(i*1.0/range[2]) <= i)
            {
                rez++;
            }

            if(r > 1000)
                rez += r-1000LL;

            cout << rez;
        }
    }
}
/*

9 6 9 8302422 3519558

*/