#include <iostream>
int Mnozi(int nesto,int L, int R,int p, int q, int r);
int main()
{
	int p, q, r, R, L;
	scanf("%d %d %d %d %d", &p, &q, &r, &L, &R);

	int brojac = 0;
	brojac += Mnozi(p*q, L, R, p, q, r);
	brojac += Mnozi(q*r, L, R, p, q, r);
	brojac += Mnozi(r*p, L, R, p, q, r);
	printf("%d", brojac);


}

int Mnozi(int nesto,int L, int R,int p, int q, int r) {
	
	if (nesto>R )
		return 0;
	int rez = 0;
	if (nesto < L)
		rez = 0;
	else  
		rez = 1;
	if(nesto*p<=R)
		rez += Mnozi(nesto * p, L, R, p, q, r);
	if(nesto*q<=R)
		rez += Mnozi(nesto * q, L, R, p, q, r);
	if(nesto*r<=R)	
		rez += Mnozi(nesto * r, L, R, p, q, r);
	return rez;
}