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

using namespace std;

typedef long long ll;
typedef long double ld;

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

ld p, q, r;

bool possible(const ll& N){
	bool poss = false;
		ll num1 = ceil(N/p);
		ll num2 = ceil(N/q);
		ll num3 = ceil(N/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;

	loop(i, L, R){
		if(i<presporo_nadalje){
			if(possible(i)){
				++solutions;
			}
		}else{
			solutions += R - i + 1;
			break;
		}
	}
	cout << solutions;

  return 0;
}