#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int p, q, r, L, R;
    cin>>p>>q>>r>>L>>R;
    int br = 0, ppom, qpom, rpom;
    for(int i = L ; i < (R + 1) ; i++){
        ppom = ceil(i/(p * 1.0));
        qpom = ceil(i/(q * 1.0));
        rpom = ceil(i/(r * 1.0));
        if((ppom + qpom + rpom) < (i+1)) br++;
    }
    cout<<br<<endl;
    return 0;
}