#include<iostream>
#include<cmath>

using namespace std;

int main() {
	long long L, R, br=0, yes=0, no=0;
	double p,q,r;	
	cin>>p>>q>>r>>L>>R;
	for (long long n=L; n<=R; n++) {
		if (	
			ceil(n/p)+ceil(n/q)+ceil(n/r)<=n
		){
		br++;
		yes++;
		no=0;
		}
		else{
			yes=0;
			no++;
		}		
		if(yes>500){
			br=br+R-n;
			n=R;
		}
		if(no>500){
			br=br;
			n=R;
		}
	}
	cout<<br;
	return 0;
}