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

int main()
{
    double p,q,r,interval1,interval2;
    cin>>p>>q>>r>>interval1>>interval2;
    int brojac=0;
    int cifre=0;
    long long int k=interval2;
    while(k>0)
    {
        k=k/10;
        cifre++;
    }
    cifre=cifre-1;
    int s=0;
    if(cifre>10)
    {
        p=interval2;
        while(s<cifre-10)
        {
            interval2=interval2/10;
            s++;
        }
    }
    for(int i=interval1; i<=interval2; i++)
    {
        double racunanje=0;
        racunanje=ceil(i/p)+ceil(i/q)+ceil(i/r);
        if(racunanje<=i)brojac++;
    }
    int cifre2=cifre;
    if(cifre2<=10)cout<<brojac;
    else
    {
        for(int i=0; i<cifre-10;i++)
        {
            cout<<9;
        }
        cout<<brojac;
    }
    return 0;
}