#include <iostream>
using namespace std;

int main(){
    int p, q, r;
    long long int L, D, br = 0, LDM;
    long long int ebr = 0;

    cin >> p >> q >> r >> L >> D;
    LDM = D - L + 1;
    double pqr = 1/((double)p) + 1/((double)q) + 1/((double)r);

    if (pqr > 1){
        cout << 0;
        return 0;
    }
    if (pqr == 1){
        int maxpqr;
        if (p >= q && p >= r)
            maxpqr = p;
        else if (q >= p && q >= r)
            maxpqr = q;
        else
            maxpqr = r;

        if (LDM % maxpqr == 0){
            cout << LDM / maxpqr;
            return 0;
        }
        else {
            while (LDM % maxpqr != 0){
                if (D % maxpqr == 0)
                    br++;
                D--;
                LDM--;
                if (L == D){
                    if (D % maxpqr == 0)
                        br++;
                    cout << br;
                }
            }
            cout << br + LDM / maxpqr;
            return 0;
        }
    }

    if (pqr < 1){
        int k = 43;
        if (D < k)
            k = D;
        for (int i = L; i <= k; ++i){
            if (((int)((i + p - 1) / p)) + ((int)((i + q - 1) / q)) + ((int)((i + r - 1) / r)) > i){
                ebr++;
                //cout << i << endl;
            }/* else {
                ebr++;
                cout << "ERROR - " << i << endl;
            } */
        }
    }

    cout << LDM - ebr;

    return 0;
}