#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll resi(ll p, ll q, ll r, ll L, ll R){
    ll broj = 0;
    for(ll i = L;i <= R;i++)
        if(ceil((double)i/p) + ceil((double)i/q) + ceil((double)i/r) <= i)
            broj++;
    return broj;
}

int main(){
    ios::sync_with_stdio(false);
    ll p, q, r, L, R;
    cin >> p >> q >> r >> L >> R;
    cout << resi(p, q, r, L, R);
    return 0;
}