#include <stdio.h>
#include <math.h>
int main(){
  long long p,q,r,L,R,i,k=0,x;
  double p1,q1,r1;
  scanf("%lld%lld%lld%lld%lld",&p,&q,&r,&L,&R);
  x=p*q*r*2;
  if (p==1 || q==1 || r==1) printf("%d",0);
   else if (x < R){
    for(i=L;i<=x;i++){
    p1=(double)i/p;
    q1=(double)i/q;
    r1=(double)i/r;
    long long c=(long long)(ceil(p1)+ceil(q1)+ceil(r1));
    if (c>i) k++;
  }
    printf("%lld",R-k);
  }
  else {for(i=L;i<=R;i++){
    p1=(double)i/p;
    q1=(double)i/q;
    r1=(double)i/r;
    long long c=(long long)(ceil(p1)+ceil(q1)+ceil(r1));
    if (c<=i) k++;
  }
    printf("%lld",k);
  }
  
}