#include<stdio.h>
main()
{
	long long int i,p,q,r,L,R,s=0,c1,c2,c3,u;
	double br1,br2,br3;
	scanf("%lld%lld%lld%lld%lld",&p,&q,&r,&L,&R);
	for(i=L;i<=R;i++)
	{
		br1=(double)i/(double)p;
		br2=(double)i/(double)q;
		br3=(double)i/(double)r;
		c1=ceil(br1);
		c2=ceil(br2);
		c3=ceil(br3);
		u=c1+c2+c3;
		if(u<=i)
		s++;
		
		if(i-u>7)
		{
			s=s+(R-i);
			break;
		}
	}
	printf("%lld",s);
}