#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;

ll p, q, r, L, R, sol;

ll cel(ll a, ll b){
    return (a/b + ((a%b)>0));
}
void brute()
{
    ll n;
    for(n=L; n<=min( (p*q*r+1) , R); n++)
        if((cel(n, p)+cel(n, q)+cel(n, r)) > n)
            sol--;
}
ll s334(){
    sol=R-L+1;
    if(L==1) sol--;
    if(L<=2 and R>=2) sol--;
    if(L<=13 and R>=13) sol--;
    return sol;
}
ll s444(){
    sol=R-L+1;
    if(L==1) sol--;
    if(L<=2 and R>=2) sol--;
    if(L<=5 and R>=5) sol--;
    return sol;
}
void dvojka(){
    if(q==2) cout<<0;
    else if(q==3){
             if(r<6) cout<<0;
             else if(r==6) cout<< (R/6 - (L-1)/6) ;
             else{
                sol=R-L+1;
                brute();
                cout<<sol;
             }
         }
    else if(q==4){
             if(r==4) cout<< (R/4 - (L-1)/4) ;
             else{
                sol=R-L+1;
                brute();
                cout<<sol;
             }
         }
    else{
        sol=R-L+1;
        brute();
        cout<<sol;
    }
}
ll opsti(){
    sol=R-L+1;
    if(L==1) sol--;
    if(L<=2 and R>=2) sol--;
    return sol;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    vector<ll> a(3);
    cin>>a[0]>>a[1]>>a[2]>>L>>R;
    sort(a.begin(), a.end());
    p=a[0];
    q=a[1];
    r=a[2];

    if(p==1) cout<<0;
    else if(p==2) dvojka();
    else if(p==3 and q==3 and r==3) cout<< (R/3 - (L-1)/3) ;
    else if(p==3 and q==3 and r==4) cout<<s334();
    else if(p==4 and q==4 and r==4) cout<<s444();
    else cout<<opsti();
    return 0;
}