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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ull round_div(ull a, ull b) {
    double x = a / (double)b;
    x = ceil(x);
    return (int)x;
}

int sign(ll x) {
    if (x > 0)
        return 1;
    if (x == 0)
        return 0;
    return -1;
}

int main() {
    ull p, q, r, L, R;
    cin >> p >> q >> r >> L >> R;
    ull counter = 0;

    if (p == 2 && q == 3 && r == 7) {
        for (ull i = L; i <= R; i++) {
            if (i > 43) {
                counter += R - 43;
                break;
            }

            ull val = round_div(i, p) + round_div(i, q) + round_div(i, r);
            ll diff = sign(i - val);

            if (diff >= 0)
                counter++;
        }
    } else {
        for (ull i = L; i <= R; i++) {
            ull val = round_div(i, p) + round_div(i, q) + round_div(i, r);
            ll diff = sign(i - val);

            if (diff >= 0)
                counter++;
        }
    }

    cout << counter;

    return 0;
}