#include <iostream>
#include <math.h>

using namespace std;

int moze(unsigned long long int p, unsigned long long int q,unsigned long long int r, unsigned long long int n){
	if((double)n/p-trunc((double)n/p)==0)
		p=trunc((double)n/p);
	else 
		p=trunc((double)n/p)+1;
		
	
	if((double)n/q-trunc((double)n/q)==0)
		q=trunc((double)n/q);
	else 
		q=trunc((double)n/q)+1;
		
	if((double)n/r-trunc((double)n/r)==0)
		r=trunc((double)n/r);
	else 
		r=trunc((double)n/r)+1;
	
	if((p+r+q)<=n)
		return 1;
	else 
		return 0;
}

int main(){
	unsigned long long int p,q,r,L,R,br;
	br=0;
	cin>>p>>q>>r>>L>>R;
	for(unsigned long long int i=L;i<=R;i++){
		if(moze(p,q,r,i)==1)
			br++;
	}
	cout<<br;
}