#include <stdio.h>
#include <stdlib.h>
#define ll long long

int main()
{
	ll int p,q,r,L,R;
	ll int temp1,temp2,temp3;
	ll int br=0;
	scanf("%i %i %i %i %i", &p, &q, &r, &L, &R);
	
	if(L<=R)
	{
		for (ll int i = L; i <= R; ++i)
		{
			if(((long double)i/p)>(ll int)i/p)
				temp1=((long double)i/p)+1;
			else if(((long double)i/p)==(ll int)i/p)
				temp1=((long double)i/p);

			if(((long double)i/q)>(ll int)i/q)
				temp2=((long double)i/q)+1;
			else if(((long double)i/q)==(ll int)i/q)
				temp1=((long double)i/q);

			if(((long double)i/r)>(ll int)i/r)
				temp3=((long double)i/r)+1;
			else if(((long double)i/r)==(ll int)i/r)
				temp1=((long double)i/r);
			if((temp1+temp2+temp3)<=i)
				br++;
		}
	}
	else
	{
		for (ll int i = R; i <= L; ++i)
		{
			if(((long double)i/p)>(ll int)i/p)
				temp1=((long double)i/p)+1;
			else if(((long double)i/p)==(ll int)i/p)
				temp1=((long double)i/p);

			if(((long double)i/q)>(ll int)i/q)
				temp2=((long double)i/q)+1;
			else if(((long double)i/q)==(ll int)i/q)
				temp1=((long double)i/q);

			if(((long double)i/r)>(ll int)i/r)
				temp3=((long double)i/r)+1;
			else if(((long double)i/r)==(ll int)i/r)
				temp1=((long double)i/r);
			if((temp1+temp2+temp3)<=i)
				br++;
		}
	}
	
	printf("%i", br);

	return 0;
}