#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define loop(i,a,b) for(ll i = a; i <= b; ++i)

ll p, q, r;

bool possible(const ll& N){
	bool poss = false;
		ll num1 = ceil(N/(ld)p);
		ll num2 = ceil(N/(ld)q);
		ll num3 = ceil(N/(ld)r);
	if(num1+num2+num3 <= N) poss = true;
	return poss;
}

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll L, R;
	ll solutions = 0;

	cin >> p >> q >> r;
	cin >> L >> R;

	if(1/p + 1/q + 1/r > 1) return 0;

//	Ako je N >= ceil(N/p) + ceil(N/q) + ceil(N/r)
//	sledi N >= N/p + N/q + N/r + c (konstanta)
//	Vrednost konstante zavisi po tome koliko brojeva od p,q i r
//	deli broj N [0,3]
//	Onda sledi N - N (1/p + 1/q + 1/r) >= c
//	-> N >= c * (qrp / (qrp - qr - rp - pq)) = L (granica)
//	Odavde sledi da za vrednosti posle granice uvek vazi ova formula
	
	int constant;
	ld temp1 = q*r*p;
	ld temp2 = temp1 - q*r - q*p - r*p;
	ld multiplier = temp1/temp2;
	ll limit;

	loop(i, L, R){
		constant = 0;
		if(i%q!=0) constant++;
		if(i%r!=0) constant++;
		if(i%p!=0) constant++;
		limit = ceil(constant*multiplier);
		if(i<limit){
			if(possible(i)){
				++solutions;
			}
		}else{
			solutions += R - i + 1;
			break;
		}
	}
	cout << solutions;

  return 0;
}