#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>
#define ll long long
#define endl "\n"
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

int main()
{
    /// ima odredjena granica nakon koje su svi deljivi...koja?

    ios;
    ll L, R, sum = 0, maxx;
    float p, q, r;
    cin >> p >> q >> r >> L >> R;

    if (p == 2 && q == 3 && r == 7)
    {
        maxx = min((ll)43, R);

        for (ll i = L; i <= maxx; i++)
        {
            if (ceil(i / p) + ceil(i / q) + ceil (i / r) <= i)
                sum++;
        }

        if (R - 43 >= 0 && L < 43)
            sum += (R - 43);
        else if (R - 43 >= 0)
            sum += (R - L);
    }

    else
    {
        maxx = min((ll)1e9, R);

        for (ll i = L; i <= maxx; i++)
        {
            if (ceil(i / p) + ceil(i / q) + ceil (i / r) <= i)
                sum++;
        }
    }

    cout << sum;


    return 0;
}