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