#include <iostream>

using namespace std;

int main()
{
    long long p, q, r, L, R, N, br=0;
    cin>>p>>q>>r>>L>>R;
    for (long long i=L; i<=R; i++)
    {
        N=0;
        N+=i/p;
        if (i%p!=0)
            N++;
        N+=i/q;
        if (i%q!=0)
            N++;
        N+=i/r;
        if (i%r!=0)
            N++;
        if (N<=i)
        br++;

    }
    cout<<br;
}