#include <iostream>
//#include <bits/stdc++.h>
//#include <algorithm>
#include <cmath>
//#include <iomanip>
//#include <string>
using namespace std;

int main(){

    long double p,q,r,L,R,i,brojac=0,ne=0,zbr,a,b,c; cin >> p >> q >> r >> L >> R;
    for(i=L;i<=R;i++){
        a = ceil(i/p);
        b = ceil(i/q);
        c = ceil(i/r);
        zbr = a+b+c;
        if(zbr<=i){
            brojac++;
            if(brojac>100){
                break;
            }
        } else {
            ne++;
            brojac=0;
        }
    }
    cout << R-L-ne+1;

    return 0;
}