#include <iostream>

using namespace std;
int main()
{
    long long p,q,r,L,R;
    cin >>p>>q>>r>>L>>R;
    long long n=0;
    int m,l,o;
    for(long long i=L;i<=R;i++ ){
     if(i%p==0&&i%q==0){
        if(i%r==0){
          if(long (i/r)<=i-(long (i/p)+ long (i/q)))
            n++;}
        else { if(long (i/r+1)<=i-( long (i/r)+  long (i/q)))
            n++;}
     }
     if(i%p==0&&i%r==0){
        if(i%q==0){
          if(long  (i/q)<=i-(long  (i/p)+ long (i/r)))
            n++;}
        else {if( long (i/q+1)<=i-(long  (i/r)+ long (i/q)))
            n++;}

 }
     if(i%r==0&&i%q==0){
        if(i%p==0){
          if(long (i/p)<=i-(long  (i/r)+ long  (i/q)))
            n++;}
         else { if( long (i/p+1)<=i-( long (i/r)+ long (i/q)))
            n++;}
    }
    }
    cout <<n<<endl;

    return 0;
}