#include <iostream>
using namespace std;

int main()
{
	short int p,q,r,konst;
	unsigned long long x,y,n,brojac=0;
	cin>>p>>q>>r>>x>>y;
	if(p*q*r-p*q-p*r-q*r<0)
		cout<<0;
	else if(p*q*r-p*q-p*r-q*r==0)
	{
		int s=p;
		if(q>s)	s=q;
		if(r>s)	s=r;
		unsigned long long int gore=0,dole=0;
		for(unsigned long long int i=y;i>=x;i--)
		{
			if(i%s)	continue;
			gore=i/s;
			break;
		}
		for(int i=x;i<=y;i++)
		{
			if(i%s)	continue;
			dole=i/s;
			break;
		}
		cout<<gore-dole+1;
	}
	else{
		for(n=x;n<=y&&n<3*p*q*r;n++)
		{
			short int o=0;
			if(n%p)	o++;
			if(n%q)	o++;
			if(n%r)	o++;
			if(n/p+n/q+n/r+o<=n)
				brojac++;
		}
		brojac+=y-n+1;
		cout<<brojac;
	}
	return 0;
}