#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long p,q,r;
    long long L,R,s=0,a=1000000;
    cin>>p>>q>>r>>L>>R;
    for(long long i=L;i<=min(R,L+a);i++)
    {
        if(ceil(i/(double)p)+ceil(i/(double)q)+ceil(i/(double)r)<=i)s++;
    }
    s=s+R-min(R,L+a);
    cout<<s;
    return 0;
}