#include <iostream>
#include <queue>

using namespace std;


int main()
{
    int p, q, r;
    long long lf, rg;
    cin >> p >> q >> r >> lf >> rg;
    int x;
    x = p * q * r - p * q - p * r - q * r;
    if (x < 0)
    {
        cout << 0;
    }
    else if (x >= 3)
    {
        if (lf == 1)
        {
            cout << rg - 2;
        }
        else if (lf == 2)
        {
            cout << rg - 1;
        }
        else
        {
            cout << rg;
        }
    }
    else
    {
        int pqr = rg / (p * q * r) - lf / (p * q * r);
        if (x == 0)
        {
            cout << pqr;
        }
        else
        {
            int pq = rg / (p * q) - lf / (p * q);
            int pr = rg / (p * r) - lf / (p * r);
            int qr = rg / (q * r) - lf / (q * r);
            if (x == 1)
            {
                cout << pq + pr + qr - 2 * pqr;
            }
            else
            {
                int pp = rg / p - lf / p;
                int qq = rg / q - lf / q;
                int rr = rg / r - lf / r;
                cout << pp + qq + rr - pq - pr - qr + pqr;
            }
        }
    }
    /*cout << endl << pqr;
    cout << endl << pq << " " << */
    return 0;
}