#include <bits/stdc++.h>

using namespace std;

unsigned long long Zaokruzi(long double n){
    if(n>(unsigned long long)n)
        return (unsigned long long)n+1;
    else
        return n;
}
unsigned long long Radi(int p,int q,int r,unsigned long long L,unsigned long long R){
    unsigned long long br=0;
    for(L; L<=R; L++){
        if(Zaokruzi(L/(long double)p)+Zaokruzi(L/(long double)q)+Zaokruzi(L/(long double)r)>R){
            return br;
        }
        if(Zaokruzi(L/(long double)p)+Zaokruzi(L/(long double)q)+Zaokruzi(L/(long double)r)<=L){
            br++;
        }

    }
    return br;
}

int main()
{
   int p,q,r;
   unsigned long long L,R;
   cin>>p>>q>>r>>L>>R;
   cout<<Radi(p,q,r,L,R);

}