#include <bits/stdc++.h>
using namespace std;

long long mat[11][11][11];
long long p, q, r;
long long le, ri;

void solve1(){
    long long res = 0;
    for(long long i = max(1LL, le); i <= min((long long)1e5, ri); ++i){
        if(ceil(1.0 * i / p) + ceil(1.0 * i / q) + ceil(1.0 * i / r) <= i){
            res++;
        }
    }
    cout << res << "\n";
}

void solve2(){
    long long nzs = (p * q / __gcd(p, q));
    nzs = (nzs * r / __gcd(nzs, r));

    long long res = ri / nzs - (le - 1) / nzs;
    cout << res << "\n";
}

void solve3(){
    long long res = 0;
    for(long long i = max(1LL, le); i <= min((long long)1e5, ri); ++i){
        if(ceil(1.0 * i / p) + ceil(1.0 * i / q) + ceil(1.0 * i / r) <= i){
            res++;
        }
    }

    long long left = ri - min((long long)1e5, ri);
    res += left;
    cout << res << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(0) << fixed;

    //int ls = 0, sm = 0, bg = 0;

    for(long long i = 1; i <= 10; ++i){
        for(long long j = i; j <= 10; ++j){
            for(long long k = j; k <= 10; ++k){
                long long nzs = (i * j / __gcd(i, j));
                nzs = (nzs * k / __gcd(nzs, k));
                long long jb1 = nzs - ceil(1.0 * nzs / i) - ceil(1.0 * nzs / j) - ceil(1.0 * nzs / k);
                long long jb2 = 2 * nzs - ceil(2.0 * nzs / i) - ceil(2.0 * nzs / j) - ceil(2.0 * nzs / k);
                mat[i][j][k] = jb2 - jb1;
//                if(mat[i][j][k] < 0)
//                    ls++;
//                else if(mat[i][j][k] == 0)
//                    sm++;
//                else
//                    bg++;
            }
        }
    }

//    cout << ls << " " << sm << " " << bg << "\n";
//    return 0;

    long long tmp[3];
    cin >> tmp[0] >> tmp[1] >> tmp[2] >> le >> ri;
    sort(tmp, tmp + 3);
    p = tmp[0]; q = tmp[1]; r = tmp[2];

    if(mat[tmp[0]][tmp[1]][tmp[2]] < 0){
        solve1();
    }else if(mat[tmp[0]][tmp[1]][tmp[2]] == 0){
        solve2();
    }else{
        solve3();
    }
    return 0;
}