#include <bits/stdc++.h>
#define ll unsigned long long
#define si short int
using namespace std;
ll p,q,r,L,R;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin>>p>>q>>r>>L>>R;
    if(p==1||q==1||r==1)
        return cout<<"0"<<endl, 0;

    ll koliko=0;
    auto start = chrono::steady_clock::now();
    while(L<=R)
    {
        ll pom=0;
        double pom1,pom2,pom3;
        pom1=double(L)/double(p);
        //cout<<setprecision(3)<<pom1<<' ';
        pom2=double(L)/double(q);
        //cout<<setprecision(3)<<pom2<<' ';
        pom3=double(L)/double(r);
        //cout<<setprecision(3)<<pom3<<' ';
        if(floor(pom1)==ceil(pom1)) pom+=pom1;// cout<<"11 ";
        else pom+=pom1+1;//cout<<"12 ";

        if(floor(pom2)==ceil(pom2)) pom+=pom2;//cout<<"21 ";
        else pom+=pom2+1;//cout<<"22 ";

        if(floor(pom3)==ceil(pom3)) pom+=pom3;//cout<<"31 ";
        else pom+=pom3+1;//cout<<"32 ";
        //cout<<endl;
        //cout<<pom<<endl;
        if(pom<=L)
        {
            koliko++;
            //cout<<pom<<' ';
            //cout<<L<<endl;
        }
        L++;
    }
    auto end = chrono::steady_clock::now();
    auto diff = end - start;
    //cout<<chrono::duration <double, milli> (diff).count()<<"ms";
    cout<<endl;
    cout<<koliko;
    /*
    ll koliko=0;
    double pom=racunica(L);
    //cout<<pom<<endl;
    while(pom<L+3 && L<R)
    {
        if(pom>=L)
        {
            int brc=0;
            brc = ((ll)(pom)%p==0)?brc:brc+1;
            brc = ((ll)(pom)%q==0)?brc:brc+1;
            brc = ((ll)(pom)%r==0)?brc:brc+1;
            if((ll)(pom)-L>=brc)
            {
                koliko++;
                cout<<L<<' ';
            }
        }
        L++;
        pom=racunica(L);
    }
    koliko+=R-L+1;
    */
    //cout<<koliko;
    //if((double)(n*(q*r+q*p+p+r)/p*q*r)>=n+3)

}