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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);

    double p,q,r;
    long long int L , R, final_score , score,temp;
    long double value;

    cin >> p >> q >> r >> L >> R;


    if (p < q)
        swap(p, q);

    if (p < r)
        swap(p, q);

    if (r < p)
        swap(r, p);


    final_score =0;
    score=0;
    temp = 0;

    if((p==1)||(q==1)||(r==1))
    {

        cout << 0;

    } else if((p==q) && (q==r) &&(r==3))
    {
        
            final_score=(floor(R/3)-floor((L-1)/3));
    } else if((p==2)&&(q==3)&&(r==6))
    {
      

        final_score=(floor(R/6)-floor((L-1)/6));
    } else if((r==4)&&(q==4)&&(p==2))
    {
       

        final_score = (floor(R/4)-floor((L-1)/4));
    }else
    {
      

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


        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+=1;
                }
            }

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

        }
    }


     cout << final_score;
}