#include <iostream>
#include <math.h>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int p, q, r;
    uint64_t  L, R;
    cin >> p >> q >> r >> L >> R;

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

        cout << x;
    } else {
        for (uint64_t i = L; i <= 100; i++) {
            uint64_t t = ceil((long double) i / p) + ceil((long double) i / q) + ceil((long double) i / r);
                if (t <= i) x++;
        }

        cout << R - (100 - x);
    }
    return 0;
}