#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll p,q,r,a,b;
    cin >> p >> q >> r >> a >> b;
    ll pqr=p*q*r,bb=pqr-p*q-q*r-r*p;
    ll tmp=bb/pqr;
    ll ans=0;
    if (tmp>=0)
    {
        tmp=3*pqr/bb;
        if (pqr%bb!=0) ++tmp;
        if (tmp<a) ans=b-a+1; else
        {
            if (tmp<b) { ans=b-tmp; b=tmp; }
            for (ll i=a;i<=b;i++)
            {
                ll np=i/p;
                if (i%p!=0) ++np;
                ll nq=i/q;
                if (i%q!=0) ++nq;
                ll nr=i/r;
                if (i%r!=0) ++nr;
                if (np+nq+nr<=i) ans++;
            }
        }
    }
    cout << ans;
    return 0;
}