#include <iostream>
#include <cmath>

using namespace std;


int main()
{
    long double n,p,q;
    long long L,R;
    cin>>n>>p>>q>>L>>R;
    long double c=0,a1,a2,a3;

    for (long double k=L;k<=R;k++)
    {
        a1=ceil(k/n);
        a2=ceil(k/p);
        a3=ceil(k/q);
        if((a1+a2+a3)<=k)
            c++;
    }
    cout<<c;

    return 0;
}