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

unsigned long long p, q, r, L, R, br;
double prvi, drugi, broj;
unsigned long long ceo, minn;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> p >> q >> r >> L >> R;

	minn = min(min(p,q), r);

	broj = (float)(p*q+p*r+q*r)/(p*q*r);
	if (broj > 1) cout << 0;
	else if (broj == 1) {
		cout << (R / p) - ((L - 1) / p);
	}
	else {
		
	ceo = (1 - broj)*10 + 1;
	
	if (ceo >= 3) cout << R - minn + 1;
	
	else if (ceo == 2) {
		for (int i = L; i <= R; i++) 
			if (i%p==0 || i%q==0 || i%r==0) br++;
		cout << br;
	}
	
	else if (ceo == 1) { 
		for (int i = L; i <= R; i++)
			if ((i%p==0 && i%q==0) || (i%p==0 && i%r==0) || (i%r==0 && i%q==0)) br++;
		cout << br;
	}
}
}