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

using namespace std;

int main()
{
    int p,q,r;
    long long L, R;
    int br = 0;
    cin >> p; cin >> q; cin >> r; cin >> L; cin >> R;
    
    /*for (int i = 1; i <= __gcd(__gcd(p,q),r); i++)
    {
        double pDeo = (i%p*1.0)/p;
        double qDeo = (i%q*1.0)/q;
        double rDeo = (i%r*1.0)/r;
        if (pDeo != 0) pDeo = 1 - pDeo;
        if (qDeo != 0) qDeo = 1 - qDeo;
        if (rDeo != 0) rDeo = 1 - rDeo;
        cout << pDeo << " " << qDeo << " " << rDeo << "\n";
    }
    */
    
    for (long long i = L; i <= R; i++)
    {
        if ((long long)ceil((long double)i/p)+(long long)ceil((long double)i/q)+(long long)ceil((long double)i/r)<=i)
            br++;
    }
    cout << br;
    
    return 0;
}