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

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

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

void solve2(){
    int nzs = p * q * r / __gcd(p, __gcd(q, r));
    long long res = ri / nzs - (li - 1) / nzs;
    cout << res << "\n";
}

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

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

int main()
{
    for(int i = 1; i <= 10; ++i){
        for(int j = i; j <= 10; ++j){
            for(int k = j; k <= 10; ++k){
                double nzs = int(i * j * k / __gcd(__gcd(i, j), k));
                int jb1 = nzs - ceil(nzs / i) - ceil(nzs / j) - ceil(nzs / k);
                int jb2 = 2 * nzs - ceil(2 * nzs / i) - ceil(2 * nzs / j) - ceil(2 * nzs / k);
                mat[i][j][k] = jb2 - jb1;
            }
        }
    }

    int 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;
}