#include <bits/stdc++.h>
using namespace std;
float p,q,r;
long long L,R;
long long br;
int niz[15];
int main (){
    scanf("%f %f %f %lld %lld",&p,&q,&r,&L,&R);
    int z1=p,z2=q,z3=r;
    niz[z1]++;niz[z2]++;niz[z3]++;
    if(niz[2]>=2){cout << 0 << endl;return 0;}
    if(R<=3){cout<<0<<endl;return 0;}
    if(niz[1]>0){cout<<0<<endl;return 0;}
    if(R<=100000){
        for(int i = L; i <= R; i++){
            if(ceil(i/p)+ceil(i/q)+ceil(i/r)<=i){
                br++;
            }
        }
        cout << br << " ";
        return 0;
    }
    br=0;
    if(niz[2]==1 and niz[3]==1 and niz[6]==1){
        cout<<(R-L)/6<<endl;
        return 0;
//        return 0;
    }
    if(niz[3]==3){
        cout << (R-L)/3 << endl;
        return 0;
    }
    if(L<=50){
        for(int i = L; i <= 50; i++){
            if(ceil(i/p)+ceil(i/q)+ceil(i/r)<=i){
                br++;
            }
        }
        br+=R-50;
    }else{
        br=R-L+1;
    }
    cout << br << endl;
return 0;
}