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

short int p,q,r;
unsigned long long L,R;
unsigned long long rez;
int i;

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

	if((1/float(p) + 1/float(q) + 1/float(r)) > 1.0) {
		cout << 0;
		return 0;
	}
	
	if (R <= 30){
		for (i = L; i <= R; i++) if ((ceil(i/float(p)) + ceil(i/float(q)) + ceil(i/float(r))) <= i) rez++;
		
	}
	else {
		if (p == q == r == 3) rez = R/3 - L/3;
		else {
			for (i = L; i <= 30; i++) if ((ceil(i/float(p)) + ceil(i/float(q)) + ceil(i/float(r))) <= i) rez++;
			rez += R - 30;
		}
	}
	
	cout << rez;
	
	return 0;
}