#include <bits/stdc++.h>
using namespace std;
long long NZS(long long a, long long b, long long c)
{
    long long i = a;
    while (i % b > 0 || i % c > 0) i = i + a;
    return i;
}
long long f(long long p, long long q, long long r, long long n)
{
    long long ret = 0;
    if(n % p > 0) ret = ret + 1;
    if(n % q > 0) ret = ret + 1;
    if(n % r > 0) ret = ret + 1;
    ret = ret + n/p + n/q + n/r;
    return ret;
}
int main()
{
    long long p, q, r, L, R, ans = 0, x;
    cin >> p >> q >> r >> L >> R;
    if(p*q*r - p*q - q*r - r*p < 0) {cout << 0; return 0;}
    else if(p*q*r - p*q - q*r - p*r == 0)
    {
        x = NZS(p, q, r);
        ans = (R - L + 1)/x;
        cout << ans;
        return 0;
    }
    if(R > 500)
    {
        ans = ans + R - 500;
        R = 500;
    }
    while(L <= R)
    {
        if(f(p,q,r,L) <= L) ans++;
        L++;
    }
    cout << ans;
    return 0;
}