//ceil algoritam uzet sa sajta https://www.tutorialspoint.com/find-ceil-of-a-b-without-using-ceil-function-in-cplusplus
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long p,q,r,L,R;
cin>>p>>q>>r>>L>>R;
long long brojac=0;
for(int i=L; i<=R;i++){
    if((i+p-1)/p+(i+q-1)/q+(i+r-1)/r <= i) brojac++;
}
cout<<brojac;
return 0;
}