#include<bits/stdc++.h>
using namespace std;
long long L,R,x;
double p,q,r,mn,mx;
int main(){
cin>>p>>q>>r>>L>>R;
mn=min(p,min(q,r));
mx=max(p,max(q,r));
if(p==1 or q==1 or r==1){cout<<0<<endl;return 0;}
else if(mn==2 and p+q+r-mn-mx==2 ){cout<<0<<endl;return 0;}
     else if(mn==2 and p+q+r-mn-mx==3 and(mx==3 or mx==4 or mx==5) ){cout<<0<<endl;return 0;}
          else if(mn==2 and p+q+r-mn-mx==3 and mx==6 ){cout<<R/6-L/6<<endl;return 0;}
               else if(mn==2 and p+q+r-mn-mx==3 and mx==7 ){
                    if(R>=50){
                    for(float i=L;i<=50;i++){
                        if(ceil(i/p)+ceil(i/q)+ceil(i/r)<=i){x++;}}cout<<x+R-50<<endl;}
                    else {for(float i=L;i<=R;i++){if(ceil(i/p)+ceil(i/q)+ceil(i/r)<=i){x++;}}cout<<x<<endl;}
                   return 0;
               }
                    else if(p==3 and q==3 and r==3){cout<<R/6-L/6<<endl;return 0;}
                         else if(p==4 and q==4 and r==4){cout<<R/6-L/6<<endl;return 0;}
                              else {for(float i=L;i<=10;i++){if(ceil(i/p)+ceil(i/q)+ceil(i/r)<=i){x++;}}
                                    cout<<R-L+1-10+x<<endl;
                                    }


    return 0;}