#include <iostream>
#include<cmath>
using namespace std;

int main()
{
    double p,q,r,interval1,interval2;
    cin>>p>>q>>r>>interval1>>interval2;
    int brojac=0,brojac2=0;
    long long int k=interval2;
    int in1=interval1, in2=interval2;
    int cifre=0;
    while(k>0)
    {
        k=k/10;
        cifre++;
    }
    cifre=cifre-1;
    if((in1==1||in1%10==0)&&in2%10==0)
    {
        if(in1==1)
        {
            for(int i=1; i<=10; i++)
            {
                double racunanje=0;
                racunanje=ceil(i/p)+ceil(i/q)+ceil(i/r);
                if(racunanje<=i)brojac++;
            }
            for(int i=0; i<cifre-1; i++)
            {
                cout<<9;
            }
            cout<<brojac;
        }
        else if(in1%10==0)
        {
            int nule=0;
            int inpom=in1;
            while(in1>0)
            {
                in1=in1/10;
                nule++;
            }
            nule=nule-1;
            for(int i=0; i<cifre-nule; i++)
            {
                cout<<9;
            }
            for(int i=0; i<nule-1; i++)
            {
                cout<<0;
            }
            cout<<1;
        }
    }
    else if(interval2-interval1<=1000000)
    {
        for(int i=interval1; i<=interval2; i++)
        {
            double racunanje=0;
            racunanje=ceil(i/p)+ceil(i/q)+ceil(i/r);
            if(racunanje<=i)brojac2++;
        }
        cout<<brojac2;
    }

    return 0;
}