#include <bits/stdc++.h>

using namespace std;

int Calculate(double x, int p, int q, int r)
{
    return ceil(x/p) + ceil(x/q) + ceil(x/r);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long long p, q, r, L, R, n = 0;
    cin >> p >> q >> r >> L >> R;
    for(double i = 0; i <= (R-L)/2; ++i)
    {
        if (L + i != R - i)
        {
            if(Calculate(L+i, p, q, r) <= L+i)
                n++;

            if(Calculate(R-i, p, q, r) <= R-i)
                n++;
        }
        else if (Calculate(L+i, p, q, r) <= L+i)
            n++;
    }
    cout << n;
    return 0;
}