//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64

#include <iostream>
#include <cmath>
using namespace std;

#define max2(a, b) ((a) > (b) ? (a) : (b))

typedef unsigned long long lmfn; // LMFN = large motherfucking number

lmfn ceiling(lmfn N, lmfn q) {
    return ceil(N / (double) q);
}

int main() {
    lmfn p, q, r, L, R;
    
    cin >> p >> q >> r >> L >> R;
    
    lmfn brojilac = p * q + p * r + q * r;
    lmfn imenilac = p * q * r;
    
    if (brojilac > imenilac) { cout << 0 << endl; return 0; }
    
    if (brojilac == imenilac) {
        lmfn maks = max2(max2(p, q), r);
        
        lmfn br = R / maks - ceil(L / (double) maks) + 1;
        
        cout << br << endl;
    
        return 0;
    }
  
    lmfn granica = ceil( (3 * imenilac) / (imenilac - brojilac) );
    
    if (L > granica) { cout << (R - L + 1) << endl; return 0; }
    
    if (R < granica) {
        lmfn count = 0;
    
        for (lmfn i = L; i <= R; i++) {
            if (ceiling(i, p) + ceiling(i, q) + ceiling(i, r) <= i) count++;
        }
        
        cout << count << endl;
        return 0;
    }

    lmfn count = 0;
    
    for (lmfn i = L; i <= granica; i++) {
        if (ceiling(i, p) + ceiling(i, q) + ceiling(i, r) <= i) count++;
    }
    
    count += R - granica;
    
    cout << count << endl;
   
    return 0;
}