#include <iostream>
#include <cmath>
using namespace std;
long double n,p,q,x,y,z,w,e,t;
long long l,r,b=0;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void izracunaj(long long d)
{
	    w=floor(d/n);
    if(n*w==d)
    {
    	x=w;
	}else
	{
		x=w+1;
	}
		e=floor(d/p);
    if(p*e==d)
    {
    	y=e;
    	
	}else
	{
		y=e+1;
	}
		t=floor(d/q);
    if(q*t==d)
    {
    	z=t;
	}else
	{
		z=t+1;
	}
	
}
int main(int argc, char** argv) {

	cin>>n>>p>>q>>l>>r;
	for(long long i=l;i<=r;i++)
	{
		izracunaj(i);
	

	if(x+y+z<=i)
	{
		b++;
			}		
	}

	
	cout<<b;

	return 0;
}