#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int r, q, p, L, R;
    int i;

   int k  = 0;
    cin >> r >> q >> p >> L >> R;
    for(i = L; i <= R; i++){
        float N = i;
    float exp = ceil(N / p) + ceil(N / q) + ceil(N / r);
    if(exp <= N){
        k++;
    }}

cout << k << endl;
    return 0;
}