#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    unsigned long long int a, b, res = 0;
    float p, q, r;
    cin>>p>>q>>r>>a>>b;

    int i = a;
    int g = 0;
    bool da = true;
    while(i <= b && da==true)
    {
        double x = i / p;
        double y = i / q;
        double z = i / r;

        int c = ceil(x);
        int d = ceil(y);
        int e = ceil(z);

        int rez = c + d + e;
        if(rez <= i)
        {
            res++;
            g++;
        }
        else
            g = 0;
        i++;
        if(g > 1000 && g > p*q*r)
            da = false;
    }

    if(da == false && i < b)
        res += b - i + 1;

    cout<<res;

    return 0;
}