#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long L,R;
    long long p,q,r;
    cin>>p>>q>>r>>L>>R;
    double br1,br2,br3;
    long long br11,br22,br33;
    long long x,y,z;
    long long rez=0;
    long long brojac=0;
    for(long long i=L;i<=R;i++)
    {
        br1=i*1.0/p;
        br2=i*1.0/q;
        br3=i*1.0/r;
        x=br1*10;
        y=br2*10;
        z=br3*10;
        if((x%10)>0)
            br11=round(br1-0.5)+1;
        else
            br11=br1;
        if(y%10>0)
            br22=round(br2-0.5)+1;
        else
            br22=br2;
        if(z%10>0)
            br33=round(br3-0.5)+1;
        else
            br33=br3;
        rez=br11+br22+br33;
        if(rez<=i)
            brojac++;
    }
    cout << brojac;
}