#include<iostream>
#include<cmath>
using namespace std;

int p, q, r;
unsigned long long L, R;
long long i; long long j;
bool dp[1000000000000000000];
long long rez;
int m; short int X;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
	
	cin >> p >> q >> r >> L >> R;
	if ((p+q+r) > 10){
		m = min(min(p,q),r); (m == p) ? X = 1 : (m == q) ? X = 2 : X = 3;
		if (X == 1) for (i = L; i <= R; i += p) if (i % q == 0 || i % r == 0) dp[i-L] = true, rez++;
		else if (X == 2) for (i = L; i <= R; i += q) if (i % p == 0 || i % r == 0) dp[i-L] = true, rez++;
		else for (i = L; i <= R; i += r) if (i % p == 0 || i % q == 0) dp[i-L] = true, rez++;
		
		for (i = L; i <= R; i++) if (!dp[i-L])
			if ((ceil(i/float(p)) + ceil(i/float(q)) + ceil(i/float(r))) <= i)
				for (j = i; j <= R; j += i) rez++, dp[j-L] = true;
	}
	else cout << 0;
	
	cout << rez;
	return 0;
}