#include <iostream>
#include <cmath>
#include <limits>

using namespace std;

int nzs(int A, int B, int C)
{
    int i = A;
    while(true)
    {
        if (i%B==0 && i%C==0)
            break;
            i+=A;
    }
    return i;
}

int main()
{
    int p,q,r;
    int Nkp,Nkq,Nkr,gr,triknzs;
    long long finres=0,L,R;
    float zerochecker;
    cin >> p >> q >> r >> L >> R;
    zerochecker = (1/p + 1/q + 1/r);
    if(zerochecker >= 1)
        finres = 0;
    else
    {
        double jedknzs = (double)1/nzs(p,q,r);
        triknzs = 3/jedknzs;
        if(R>triknzs)
        {
            gr = triknzs;
            finres+=R-triknzs;
        }
        else
            gr = R;

        for(int i=L;i<=gr;i++)
        {
            Nkp = ceil((float)i/p);
            Nkq = ceil((float)i/q);
            Nkr = ceil((float)i/r);
            if(Nkp+Nkq+Nkr <= i)
            {
                finres++;
            }
        }
    }
    cout << finres;
}