#include <iostream>
#include <cmath>
using namespace std;
double p,q,r;
long long L,R;


int main()
{
    cin >> p >> q >> r >> L >> R;
    long long br = 0;
    for(long long s = L;s <= R;s++)
    {
        if(ceil(s/p)+ceil(s/q)+ceil(s/r) > s)
        {
            br++;
        }
        if(ceil(s/p)+ceil(s/q)+ceil(s/r) -s < -3)
            break;
    }
    cout << R - L + 1 - br;
}