#include <stdio.h>

using namespace std;

int main()
{
     long long int p, q, r, L, R;
    scanf("%lld%lld%lld%lld%lld", &p,&q,&r,&L,&R);

    long long int br = 0;
    for(long long int n = L; n <= R; n++){
        long long int vr = 0;
        vr += (n/p)+(n/q)+(n/r);
        if(n%p != 0) vr++;
        if(n%q != 0) vr++;
        if(n%r != 0) vr++;

        if(vr <= n) br++;
    }

    printf("%lld", br);

    return 0;
}