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

using namespace std;

int main(){
    long p, q, s, l, r , i, br=0;
    cin >> p >> q >> s >> l >> r;
    for(i=l;i<=r;i++){
        long double a= ceil((long double)i/(long double)p);
        long double b= ceil((long double)i/(long double)q);
        long double c= ceil((long double)i/(long double)s);
        if(i==a+b+c){
            br++;
        }
    }
    cout << br;
    return 0;
}