#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;

ll gcd(ll a, ll b)
{ int t;
  while (b)
  { t= b;
    b = a % b;
    a = t;
  }
return a;
}

int main()
{ ll i, k ,n, p, q, r, x, y, dol, gor, sled, duz, d2, d3, suma, raz;
  ll a, b, c, abc, cik, gra, mno, poc;
  vl ul(3);
  cin>>ul[0]>>ul[1]>>ul[2];
  cin>>dol>>gor;
  sort(ul.begin(), ul.end());
  p=ul[0]; q=ul[1]; r=ul[2];
  if(gor<3){cout<<0; return 0;}//ne moze
  if(p==1||(q==2)||(p==2&&q==3&&r<6)){cout<<0; return 0;}//ne moze
  if(p>4||(p>2&&q>4)||(p>2&&q==4&&r>4))
     { raz=3-dol;
       if(raz<0) raz=0;
       suma=gor-dol+1-raz;
       cout<<suma; return 0;
     }
  duz=p*q*r; suma =0;
  d3=duz*3;
  vl era(d3+2), pera(d3+2);
  era[0]=3; pera[0]=3;
  i=p;
  while(i<=d3){era[i+1]++; i+=p;}
  i=q;
  while(i<=d3){era[i+1]++; i+=q;}
  i=r;
  while(i<=d3){era[i+1]++; i+=r;}
  for(i=1;i<=d3;i++)
   { pera[i]=pera[i-1]+era[i];
     if(pera[i]<= i) suma++;
   }
  //cout<<endl<<"suma = "<<suma<<endl;
  //for(i=0;i<=d3;i++)cout<<endl<<i<<" "<<era[i]<<" "<<pera[i];

 //razmatranje
  if(pera[duz]<duz)//ako moze
    { if(dol>=d3) {cout<<gor-dol+1; return 0;}//ako je iznad tranice
      if(gor<d3) gra=gor; else gra=d3;
      suma=0;
      for(i=dol;i<=gra;i++) if(pera[i]<=i) suma++;
      suma+=(gor-gra);
      cout<<suma; return 0;
    }
  else if(pera[duz]==duz)//ako je konstantno
    { cik=suma/3;//po jednom ciklusu
      mno=gor/duz-(dol+duz-1)/duz;//broj ciklusa
      suma=cik*mno;
      poc=dol%duz; if(poc==0) poc=duz;
      for(i=poc;i<=duz;i++) if(pera[i]<=i)suma++;
      poc=gor%duz;
      for(i=1;i<=poc;i++) if(pera[i]<=i)suma++;
      cout<<suma<<endl;
      return 0;
    }
  else//ima grannicu, mada ne postoji
    { if(dol>=d3) {cout<<0; return 0;}//ako je iznad tranice
      if(gor<d3) gra=gor; else gra=d3;
      suma=0;
      for(i=dol;i<=gra;i++) if(pera[i]<=i) suma++;
      cout<<suma; return 0;
    }
  //cout <<suma << endl;
  return 0;
}
/*
2 3 6 1 32

2 3 7 9 14
(2)

3 4 5 1 10

3 4 5 1 1000000000000000000
(999999999999999998)

*/