#include<iostream>
#include<cmath>

using namespace std;

int main() {
	long long L, R, br=0, yes=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++;
		}
		else{
			yes=0;
		}		
		if(yes>200){
			br=br+R-n;
			n=R;
		}
	}
	cout<<br;
	return 0;
}