#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int p,q,r,L,R;
    int Nkp,Nkq,Nkr,finres=0;
    float zerochecker;
    cin >> p >> q >> r >> L >> R;
    zerochecker = (1/p + 1/q + 1/r);
    if(zerochecker >= 1)
        finres = 0;
    else
        for(int i=L;i<=R;i++)
        {
            Nkp = ceil((float)i/p);
            Nkq = ceil((float)i/q);
            Nkr = ceil((float)i/r);
            if(Nkp+Nkq+Nkr <= i)
            {
                finres++;
            }
        }
    cout << finres;
}