#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    long long p,q,r,L,R;
    scanf("%lld%lld%lld%lld%lld",&p,&q,&r,&L,&R);
    long long n=round((3*p*r*q)/(p*q*r-p*q-p*r-q*r))+1;
    long long brojac=0;
    if (n<=R && n>=L)
    {
        for (long long i=1;i<=n;i++)
        {
            long long br=0;
            if (i%p) br++;
            if (i%q) br++;
            if (i%r) br++;
            br+=i/p+i/q+i/r;
            if (br<=i) brojac++;
        }
    brojac+=R-n;
    }
    else if (R<n)
        for (long long i=L;i<=R;i++)
        {
            long long br=0;
            if (i%p) br++;
            if (i%q) br++;
            if (i%r) br++;
            br+=i/p+i/q+i/r;
            if (br<=i) brojac++;
        }
    else brojac+=R-L+1;
    printf("%lld",brojac);
}

/*
(pq+pr+qr)*n/pqr+3<=n

3*pqr<=n*pqr-n*(pq+pr+qr)

3*pqr/(pqr-pq-pr-qr)<=n
*/