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

int main()
{
    long long int p, q, r, L, R, i, j=0, k=0, s=0;
    scanf("%lld %lld %lld %lld %lld", &p, &q, &r, &L, &R);
    for (i=L; i<=R; i++){
        if (s>100000){
            j=R-L-k+1;
            break;
        }
        if (ceil((double)i/p)+ceil((double)i/q)+ceil((double)i/r)<=i){ j++; s++;}
        else {k++; s=0;}
    }
    printf ("%lld", j);
}