#include <stdio.h>

int main() 
{
int p,q,r;
long long a,b,s=0,i;
scanf("%d%d%d%lld%lld",&p,&q,&r,&a,&b);
float k,l;
k=1.0-1.0/p-1.0/q-1.0/r;
if(k<0)
{
    printf("0");
    return 0;
}
l=1.0/k;
for(i=a;i<=(long long)l*3&&i<=b;i++)
if(i/p+(i%p>0)+i/q+(i%q>0)+i/r+(i%r>0)<=i)
{
    s++;
}
if(b>l*3)
s+=b-(long long)l*3;
printf("%lld",s);
return 0;
}