#include <iostream>
#include <math.h>
#include <cmath>

using namespace std;


int main()
{
    ios_base::sync_with_stdio(0);
    double p,q,r,L;
    long double R;
    long double score,final_score;
    double temp;
    double value;
    cin >> p >> q >> r >> L >> R;

    final_score = 0;
    temp = 0;

    if(R > 1000)
    {
       temp = R-1000;
       R = 1000;
    }

    for(int i = L; i<=R ; i++)
    {
        score = 0;
        value = ceil(i/p);
        score+=value;
        value = ceil(i/q);
        score+=value;
        value = ceil(i/r);
        score+=value;
        if(score <= i)
        {
            final_score++;
        }

    }

    if((temp != 0) && (final_score!=0) )
    {
        final_score+=temp;
    }

    cout << final_score;

}