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

using namespace std;


int main() {
	int p, q, r, L, R;
	cin >> p >> q >> r >> L >> R;
	int counterp = 0, counterq = 0, counterr = 0;
	if (L%p > 0) {
		counterp = L / p + 1;
	}
	else counterp = L / p;
	if (L%q > 0) {
		counterq = L / q + 1;
	}
	else counterq = L / q;
	if (L%r > 0) {
		counterr = L / r + 1;
	}
	else counterr = L / r;
	int counter = 0;
	for (int i = L; i <= R; i++) {
		if (i % p == 0 && counterp != i / p) {
			counterp++;
		}
		if (i % q == 0 && counterq != i/q){
			counterq++;
			}
		if (i % r == 0 && counterr != i/r){
			counterr++;
			}
		int zbir = counterp + counterq + counterr;
		if (zbir <= i)counter++;
	}
	cout << counter;
	return 0;
}