#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll p,q,r,a,b;

ll krljaj(ll x){
    ll br = max(0ll,b-x+1);
    for(ll i = a; i < x && i <= b; i++){
        ll levo = (i+p-1)/p+(i+q-1)/q+(i+r-1)/r;
        if(levo <= i){
            br++;
        }
    }
    return br;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> p >> q >> r >> a >> b;
    vector <int> v;
    v.push_back(p),v.push_back(q),v.push_back(r);
    sort(v.begin(),v.end());
    p = v[0],q = v[1],r = v[2];
    if(p == 1){
        cout << 0 << endl;
        return 0;
    }
    if(p == 2 && q == 2){
        cout << 0 << endl;
        return 0;
    }
    if(p == 2 && q == 3 && r <= 5){
        cout << 0 << endl;
        return 0;
    }
    if(p == 2){
        if(q == 3){
            if(r == 6){
                ll br = b/6-a/6+(a%6==0);
                cout << br << endl;
                return 0;
            }
            ll gr = (18*r+r-7)/(r-6);
            ll sol = krljaj(gr);
            cout << sol << endl;
            return 0;
        }
        if(q == 4){
            /// sigurno r > 4 (r >= 6)
            ll gr = (12*r+r-5)/(r-4);
            ll sol = krljaj(gr);
            cout << sol << endl;
            return 0;
        }
        ll gr = (6*q+q-5)/(q-4);
        ll sol = krljaj(gr);
        cout << sol << endl;
        return 0;
    }
    if(p == 3){
        if(q == 3){
            if(r == 3){
                ll br = b/3-a/3+(a%3==0);
                cout << br << endl;
                return 0;
            }
            ll gr = (9*r+r-4)/(r-3);
            ll sol = krljaj(gr);
            cout << sol << endl;
            return 0;
        }
        ll gr = (9*q+2*q-7)/(2*q-6);
        ll sol = krljaj(gr);
        cout << sol << endl;
        return 0;
    }
    ll gr = (3*p+p-4)/(p-3);
    ll sol = krljaj(gr);
    cout << sol << endl;
}