#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);
    int p, q, r, L, R, n = 0;
    cin >> p >> q >> r >> L >> R;
    for(double i = L; i <= R; ++i)
    {
        if(Calculate(i, p, q, r) <= i)
            n++;
    }
    cout << n;
    return 0;
}