#include <iostream>

using namespace std;
int zaokruzi(double a)
{
    int x;
    x = a * 10 / 10;
    x += 1;
    double n = x;
    if (n - 1== a) x = a;
    return x;
}

int main()
{
    int p, q, r, L, R;
    cin >> p >> q >> r >> L >> R;
    int s = 0, b = 0;
    while (L <= R)
    {
        double m = (double)L / p;
        s += zaokruzi(m);
        m = (double)L / q;
        s += zaokruzi(m);
        m = (double)L / r;
        s += zaokruzi(m);
        if (s <= L) b++;
        L++;
        s = 0;
    }
    cout << b;
    return 0;
}