#include <iostream>
#include <string>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    long long int p, q, r, L, R, b=0, max, x=0, broj, broj2;
    double p1, q1, r1, q2, p2, r2, h, s;
    scanf("%lld%lld%lld%lld%lld", &p, &q, &r, &L, &R);
    max=p;
    if(q>max) max=q;
    if(r>max) max=r;
    h=double(L/max);
    broj=ceil(h);
    if(p*q*r*broj>R)
    {
        for(long long int i=L;i<=R;i++)
        {
            p1=double(i)/double(p);
            q1=double(i)/double(q);
            r1=double(i)/double(r);
            p2=ceil(p1);
            q2=ceil(q1);
            r2=ceil(r1);
            if(p2+q2+r2<=double(i)) b++,x++;
            else x=0;
            if(x==max+1) b=b+R-i,i=i+R;
        }
    }
    else
    {
        for(long long int i=L;i<broj*max;i++)
        {
            p1=double(i)/double(p);
            q1=double(i)/double(q);
            r1=double(i)/double(r);
            p2=ceil(p1);
            q2=ceil(q1);
            r2=ceil(r1);
            if(p2+q2+r2<=double(i)) b++;
        }
        for(long long int i=broj*max;i<broj*p*q*r;i++)
        {
            p1=double(i)/double(p);
            q1=double(i)/double(q);
            r1=double(i)/double(r);
            p2=ceil(p1);
            q2=ceil(q1);
            r2=ceil(r1);
            if(p2+q2+r2<=double(i)) x++;
        }
        s=double(R-broj*q*p*r);
        broj2=floor(s);
        b=b+x*broj2;
        for(long long int i=broj*p*q*r;i<R;i++)
        {
            p1=double(i)/double(p);
            q1=double(i)/double(q);
            r1=double(i)/double(r);
            p2=ceil(p1);
            q2=ceil(q1);
            r2=ceil(r1);
            if(p2+q2+r2<=double(i)) b++;
        }
    }
    printf("%lld" ,b);
}