#include<iostream>

using namespace std;

int main(){
	long long int p, q, r, n, m, br,k;
	
	cin>>p>>q>>r>>n>>m;
	
	if(p>=3 && q>=3 && r>=3){
		if(n>=3){
			cout<<m-n+1;
		}else cout<<m-2;
	}else{
		if(p==1||q==1||r==1)cout<<0;else{
		br=0;
		for(long long int i =n;i<=m;i++){
			k=0;
			if(i%p!=0) k++;
			if(i%q!=0) k++;
			if(i%r!=0) k++;
			if ((i/p+i/q+i/r+k)<=i)br++;
			
		}
		cout<<br;
		}		
	}
}