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

int main() {
    short p, q, r;
    unsigned long long L, R, i, res = 0;
    cin >> p >> q >> r >> L >> R;
	
	if(L >= p*q*r) {
		res += R-L;
		R = 0; 
		L = 0;
	}
	else if(L < p*q*r && R > p*q*r) {
		res += R-p*q*r;
		R = p*q*r;
	}
	for(i=L; i<=R; i++) {
    	if( ceil(i/(p*1.0)) + ceil(i/(q*1.0)) + ceil(i/(r*1.0)) <= i) res += 1;
	}
		
	cout << res;
	
    return 0;
}