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

using namespace std;

int main()
{
    int p, q, r;
    long double L, R;
    cin >> p >> q >> r >> L >> R;

    long long x = 0;
    for (long long i = L; i <= R; i++) {
        long double t = ceil((long double) i / p) + ceil((long double) i / q) + ceil((long double) i / r);
        if (t <= i) x++;
    }
    cout << x;
    return 0;
}