#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int p,q,r;
int nzs,gcd,br;
long long L,rightt,rez=0;
int nzd(int a,int b)
{
    int pom;
    if(a<b)
    {
        pom=a;
        a=b;
        b=pom;
    }
    if(b==0)
        return a;
    else
        return nzd(b,a%b);
}
long long jednacina(long long sred,int ost)
{
    long long broj=sred*(long long)nzs+(long long)ost;
    return broj/p+broj/q+broj/r+br;
}
long long binpret(int ost,long long ukl,long long ukr)
{
    long long poc=ukl,kraj=ukr,sred;
    if(jednacina(ukr,ost)>ukr*nzs+ost)
        return -1;
    else
    {
        if(jednacina(poc,ost)<=poc*nzs+ost)
            return ukl;
        else
        {
            while(poc<=kraj)
            {
                sred=(poc+kraj)/2;
                if(jednacina(sred,ost)<=sred*nzs+ost && jednacina(sred-1,ost)>(sred-1)*nzs+ost)
                    break;
                else
                {
                    if(jednacina(sred,ost)>sred*nzs+ost)
                        poc=sred+1;
                    else
                        kraj=sred-1;
                }
            }
            return sred;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> p >> q >> r >> L >> rightt;
    int i;
    long long k,poml,ukl,ukr,pomr;
    gcd=nzd(p,nzd(q,r));
    nzs=(p*q*r/(gcd*gcd));
    //ukl-prvi veci ili jednak sa L
    //ukr-poslednji manji ili jednak sa R
    for(i=0;i<nzs;i++)
    {
        br=0;
        if(i%p!=0)
            br++;
        if(i%q!=0)
            br++;
        if(i%r!=0)
            br++;
        if(L%nzs>i)
            ukl=(L-L%nzs)/(long long)nzs+1;
        else
        {
            ukl=(L-L%nzs)/(long long)nzs;
            if(ukl<0)
                ukl=0;
        }
        if(rightt%nzs>=i)
            ukr=(rightt-rightt%nzs)/(long long)nzs;
        else
        {
            if(rightt<i)
                ukr=-1;
            else
                ukr=((rightt-rightt%nzs)/(long long)nzs)-1;
        }
        if(ukr>=0 && ukr>=ukl)
        {
            //cout << ukl << " " << ukr << endl;
            k=binpret(i,ukl,ukr);
            //cout << ukl << " " << ukr << " " << i << " " << k << endl;
            if(k!=-1)
                rez=rez+ukr-(k-1);
        }
    }
    cout << rez;
    //cout << "Hello world!" << endl;
    return 0;
}