#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll L,R,p,q,r;
ll sol=0;

ll racunaj(ll n)
{
    return (n+p-1)/p+(n+q-1)/q+(n+r-1)/r;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin>>p>>q>>r>>L>>R;
	if(p*q+p*r+q*r>p*q*r)
    {
        cout<<0;
        return 0;
    }
    for(ll i=L;i<=R && i<=1000;i++)
    {
        if(racunaj(i)<=i)
            sol++;
    }
    if(R<=1000)
    {
        cout<<sol;
        return 0;
    }
    sol+=(R-1000);
    cout<<sol;

	return 0;
}