#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll a,b,c,l,r;
ll gr;
ll d;
ll ni[4];

ll deljivi(ll xx,ll yy,ll m)
{
    if(xx%m==0)
      return (yy/m) - (xx/m) + 1;
    return (yy/m) - (xx/m);
}

ll resi()
{
    gr = (ll)3;
    ll ans = 0;
    d = (ll)1e5;
    
    if(a==(ll)1 || b==(ll)1 || c==(ll)1)
    {
        ans = 0;
        return ans;
    }
    
    if(a > gr && b > gr && c > gr)
    {
        for(ll i = l;i<=min(l+d,r);i++)
        {
            ll x1 = (ll)ceil((double)i/a);
            ll x2 = (ll)ceil((double)i/b);
            ll x3 = (ll)ceil((double)i/c);
            if(x1+x2+x3<=i) ans++;
        }
        
        if(l+d<r)
        {
            ans = ans + (r-l-d);
        }
        
        return ans;
    }
    else if(a<=gr && b<=gr && c<=gr)
    {
        if(a==gr && b==gr && c==gr)
        {
            ans = deljivi(l,r,(ll)3);
            return ans;
        }
        else 
        {
            ans = 0;
            return ans;
        }
    }
    else 
    {
        if(a==(ll)2)
        {
            if(b==(ll)2)
            {
                ans = 0;
                return ans;
            }
            else if(b==(ll)3)
            {
                if(c==(ll)4 || c==(ll)5) 
                {
                    ans = 0;
                    return 0;
                }
                
                if(c==(ll)6)
                {
                    ans = deljivi(l,r,(ll)6);
                    return ans;
                }
                
                for(ll i = l;i<=min(l+d,r);i++)
                {
                   ll x1 = (ll)ceil((double)i/a);
                   ll x2 = (ll)ceil((double)i/b);
                   ll x3 = (ll)ceil((double)i/c);
                   if(x1+x2+x3<=i) ans++;
                }
        
                if(l+d<r)
                {
                  ans = ans + (r-l-d);
                }
        
                return ans;
                
            }
            else if(b==(ll)4 && c==(ll)4)
            {
                ans = deljivi(l,r,(ll)4);
                return ans;
            }
            else
            {
                for(ll i = l;i<=min(l+d,r);i++)
                {
                   ll x1 = (ll)ceil((double)i/a);
                   ll x2 = (ll)ceil((double)i/b);
                   ll x3 = (ll)ceil((double)i/c);
                   if(x1+x2+x3<=i) ans++;
                }
        
                if(l+d<r) ans = ans + (r-l-d);
        
                return ans;
            }
        }
        else 
        {
            for(ll i = l;i<=min(l+d,r);i++)
            {
               ll x1 = (ll)ceil((double)i/a);
               ll x2 = (ll)ceil((double)i/b);
               ll x3 = (ll)ceil((double)i/c);
               if(x1+x2+x3<=i) ans++;
            }
        
            if(l+d<r) ans = ans + (r-l-d);
        
            return ans;
        }
    }
    
    return 0;
    
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    
    cin >> ni[0] >> ni[1] >> ni[2] >> l >> r;
    
    sort(ni,ni+3);
    a=ni[0];
    b=ni[1];
    c=ni[2];
    
    cout << resi();
    
    return 0;
}