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

int main ()
{
    int p,q,r;
    long long int L,R,N,granica,X;
    N=0; X=0;
    cin >> p >> q >> r >> L >> R;
    if ((p!=1)&&(q!=1)&&(r!=1))
    {
      if (pow((p*q*r),2)>R) {granica=R;}
      else {granica=pow((p*q*r),2);}
      for (double n=L; n<=granica; n++)
      {
        if ( ((ceil(n/p)) + (ceil(n/q)) + (ceil(n/r)))>n )
        {
                N--;
                //cout << n << "\n";
        }
      }
      N=N+(R+1-L);
    }

    if (N<=0) {cout << "0\n";}
    else {cout << N << "\n";}

    /*for (double n=L; n<=R; n++)
    {
       if ( ((ceil(n/p)) + (ceil(n/q)) + (ceil(n/r)))<=n )
       {
                X++;
                cout << n << "\n";
       }

    }
    cout << X;*/

    return 0;
}