#include <bits/stdc++.h>

using namespace std;

int main()
{
    int p, q, r;
    long long L, R;

    cin >> p >> q >> r;
    cin >> L >> R;

    int a, b, c, d, s;

    a = p * q, b = p * r, c = q * r, d = p * q * r;

    s = a + b + c;

    if(s > d) {
        cout << 0 << endl;
    } else if(s == d) {
        // p, q, r {2, 3, 6} (deljivi sa 6)
        // p, q, r {2, 4, 4} (deljivi sa 4)
        // p, q, r {3, 3, 3} (deljivi sa 4)
        if(d == 27) {
            // svi brojevi izmedju L, R deljivi sa 3
            long long br = R / 3 - L / 3;
            if(L % 3 == 0) br++;
            cout << br << endl;
        } else if(d == 32) {
            long long br = R / 4 - L / 4;
            if(L % 4 == 0) br++;
            cout << br << endl;
        } else {
            long long br = R / 6 - L / 6;
            if(L % 6 == 0) br++;
            cout << br << endl;
        }
    } else if(d - s >= 3) {
        if(L <= 2) L = 3;
        cout << R - L + 1 << endl;
    } else if(d - s == 1) {
        // p, q, r {2, 3, 7} (44)
        int suma = 0, G = 0;
        long long br = 0;

        if(L > 43) {
            br = R - L + 1;
        } else if(R > 43) {
            br += R - 43;
            G = 43;
        } else {
            G = R;
        }

        for(int i = L; i <= G; ++i) {
            suma = 0;
            suma += ceil(double(i) / double(p));
            suma += ceil(double(i) / double(q));
            suma += ceil(double(i) / double(r));
            if(suma <= i) br++;
        }

        cout << br << endl;
    } else if(d - s == 2) {
        // p, q, r {2, 3, 8}
        // p, q, r {2, 4, 5}
        if(d == 40) {
            // p, q, r {2, 4, 5} (22)
            int suma = 0, G = 0;
            long long br = 0;

            if(L > 21) {
                br = R - L + 1;
            } else if(R > 21) {
                br += R - 21;
                G = 21;
            } else {
                G = R;
            }

            for(int i = L; i <= G; ++i) {
                suma = 0;
                suma += ceil(double(i) / double(p));
                suma += ceil(double(i) / double(q));
                suma += ceil(double(i) / double(r));
                if(suma <= i) br++;
            }

            cout << br << endl;
        } else {
            // p, q, r {2, 3, 8} (26)
            int suma = 0, G = 0;
            long long br = 0;

            if(L > 25) {
                br = R - L + 1;
            } else if(R > 25) {
                br += R - 25;
                G = 25;
            } else {
                G = R;
            }

            for(int i = L; i <= G; ++i) {
                suma = 0;
                suma += ceil(double(i) / double(p));
                suma += ceil(double(i) / double(q));
                suma += ceil(double(i) / double(r));
                if(suma <= i) br++;
            }

            cout << br << endl;
        }
    }

    return 0;
}