//Ona me zove, al' ja stvarno vise nisam njen
//Od sad nisam tu jer sad sam drugoj dao sve
//Ona tripuje da volim je i proci ce
//Al' sad sam shvatio da sve na svoje doci ce
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ldb long double
#define mt make_tuple
#define pii pair<int,int>
int p,q,r;
ll L,R,ans;
void input(){
	scanf("%i %i %i %lld %lld",&p,&q,&r,&L,&R);
}
void output(){
	printf("%lld\n",ans);
}
ll Get(ll ost,ll mod,ll L,ll R){L+=mod-ost;R+=mod-ost;return R/mod-(L-1)/mod;}
ll lcm(ll x,ll y){return x*y/__gcd(x,y);}
void Solve(){
	ll mod=lcm(p,lcm(q,r));
	ans=0;
	for(ll ost=0;ost<mod;ost++){
		ll dop=ost%p?p-ost%p:0;
		ll doq=ost%q?q-ost%q:0;
		ll dor=ost%r?r-ost%r:0;
		ll le=p*q*r-q*r-p*r-q*p;
		ll ri=q*r*dop+p*r*doq+p*q*dor;
		if(le==0){
			if(ri==0)ans+=Get(ost,mod,L,R);
		}
		else if(le>0){
			ll mn=(ri+le-1)/le;
			if(mn<=R)ans+=Get(ost,mod,max(mn,L),R);
		}else{
			ll mx=floor(ri/le);
			if(mx>=L)ans+=Get(ost,mod,L,min(mx,R));
		}
	}
}
void Run(){
	input();
	Solve();
	output();
}
ll bans;
void BruteForce(){
	bans=0;
	for(ll i=L;i<=R;i++)bans+=i>=(i+p-1)/p+(i+q-1)/q+(i+r-1)/r;
}
mt19937_64 rng(time(0));
void MakeTestCase(){
	p=rng()%10+1;
	q=rng()%10+1;
	r=rng()%10+1;
	const ll lim=1e18;
	L=rng()%lim+1;
	R=L+rng()%10000000;
}
bool Compare(){
	return ans==bans;
}
void Print(){
	printf("%i %i %i %lld %lld\n",p,q,r,L,R);
	printf("ans : %lld\n",ans);
	printf("bans: %lld\n",bans);
}
double GetTime(){return (ldb)clock()/CLOCKS_PER_SEC;}
double s_time,e_time,d_time;
void Start(){s_time=GetTime();}
void Stop(){e_time=GetTime();d_time=e_time-s_time;}
void Test(){
	cout<<fixed<<setprecision(4);
	int work=100000;
	double max_time=0;
	bool speed_only=0;
	for(int i=1;i<=work;i++){
		MakeTestCase();
		if(!speed_only)BruteForce();
		Start();
		Solve();
		Stop();
		if(!speed_only && !Compare()){
			Print();
			return;
		}
		max_time=max(max_time,d_time);
		cout<<i<<":OK, max time so far="<<max_time<<"\n";
	}
	cout<<":D\n";
}
int main(){
	Run();
	return 0;
}