#include <bits/stdc++.h>

using namespace std;

int ceill(int a, int b)
{
    return a/b+((a%b)!=0);
}

struct burazer
{
    int a,b,c;
};

bool trazenje(int a, int b, int c)
{
    set<int> s;
    for(int i=1000;i<=1100;i++) {
        if(ceill(i,a)+ceill(i,b)+ceill(i,c)<=i) {
            s.insert(1);
        }
        else
            s.insert(0);
    }
    return s.size()==2;
}
vector<burazer> nadji_micu()
{
    vector<burazer> mica;
    for(int i=2; i<=10; i++)
    {
        for(int j=i; j<=10; j++)
        {
            for(int k=j; k<=10; k++)
            {
                if(trazenje(i,j,k)) {
                    burazer a;
                    a.a=i; a.b=j; a.c=k;
                    mica.push_back(a);
                }
            }
        }
    }
    return mica;
}
long long resi_micu(int *a, long long L, long long R, vector<burazer> mica)
{
    if(a[0]==1) {return 0;}
    if(a[0]==2 && a[1]==2) {return 0;}
    bool trazenje=false;
    for(int i=0; i<mica.size(); ++i) {
        if(a[0]==mica[i].a && a[1]==mica[i].b && a[2]==mica[i].c) {trazenje=true; break;}
    }
    if(trazenje) {
        int val,i;
        for(i=1;;++i) {
            val=ceill(i,a[0])+ceill(i,a[1])+ceill(i,a[2]);
            if(val<=i) break;
        }
        int trazenje_size=i;
        L--; R--;
        int start=L%trazenje_size;
        long long length=R-L+1;
        if(start+length==trazenje_size) return 1;
        if(start+length<trazenje_size) return 0;
        long long ans=1;
        length-=trazenje_size-start;
        ans+=length/trazenje_size;
        return ans;
    }
    int granica=100000;
    if(L>=granica) {
        int val=ceill(granica,a[0])+ceill(granica,a[1])+ceill(granica,a[2]);
        if(val>granica) return 0;
        else return R-L+1;
    }
    else {
        if(R<=granica) {
            long long ans=0;
            for(int i=L; i<=R; ++i) {
                int val=ceill(i,a[0])+ceill(i,a[1])+ceill(i,a[2]);
                if(val<=i) ans++;
            }
            return ans;
        }
        long long ans=0;
        for(int i=L; i<=granica; ++i) {
            int val=ceill(i,a[0])+ceill(i,a[1])+ceill(i,a[2]);
            if(val<=i) ans++;
        }
        int val=ceill(granica,a[0])+ceill(granica,a[1])+ceill(granica,a[2]);
        if(val<=granica) ans+=R-granica;
        return ans;
    }
}

int main()
{
    int p,q,r;
    long long L,R;
    scanf("%d %d %d %lld %lld",&p,&q,&r,&L,&R);
    vector<burazer> mica=nadji_micu();
    int a[3];
    a[0]=p; a[1]=q; a[2]=r;
    sort(a,a+3);
    int *pa=&a[0];
    long long ans=resi_micu(pa,L,R,mica);
    cout<<ans<<endl;
    return 0;
}