#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long p,q,r,L,R,res,limit;

    scanf("%I64d %I64d %I64d %I64d %I64d",&p,&q,&r,&L,&R);
    res = R-L;

    if(p+q+r < 10)
    {
        printf("0");
        return 0;
    }

    if(R-L > 1000)
    {
        limit = 1000;
    }
    else
    {
        limit = R;
    }
    for(long long i = L;i <= limit;i++)
    {
        if(!(ceil((long double)i/p) + ceil((long double)i/q) + ceil((long double)i/r) <= i))
        {
            res--;
        }
    }

    printf("%I64d",res+1);
    return 0;
}