#include <iostream>
using namespace std;
int main()
{
    int n=0;
    int x,p,r;
    long long int L,R,x1,p1,r1;
    cin>>x>>p>>r>>L>>R;
    for (int i=L;i<R+1;i++)
    {
       x1=i/x;
       p1=i/p;
       r1=i/r;
       if (i%x>0) x1=x1+1;
       if (i%p>0) p1=p1+1;
       if (i%r>0) r1=r1+1;
       if (x1+p1+r1<=i) n=n+1;
    }
    cout<<n;
    return 0;
}