#include<stdio.h>

int main()
{
    long long int p,q,r,s,L,R,N,M,C;
    double d;
    scanf("%lld %lld %lld %lld %lld",&p,&q,&r,&L,&R);
    d=1/(double)p+1/(double)q+1/(double)r;
    if(d>1)
    {
        printf("0");
    }
    else if(d>0.99999)
    {
        if((p>=q)&&(p>=r))
        {
            s=p;
        }
        else if((q>=p)&&(q>=r))
        {
            s=q;
        }
        else
        {
            s=r;
        }
        N=R/s - L/s;
        printf("%lld",N);
    }
    else if(d<1)
    {
        N=0;
        if((R-L)<100)
        C=R;
        else
        C=L+100;
        for(M=L;M<=C;M++)
        {
            s=M/p+M/q+M/r;
            if(N % p>0)
            s+=1;
            if(N % q>0)
            s+=1;
            if(N % r>0)
            s+=1;
            if(s<=M)
            N++;
        }
        N+=R-C;
        printf("%lld",N);
    }
}