#include <stdio.h>
#include <stdlib.h>
#include <math.h>
unsigned long long int Reduce(unsigned long long int X ,unsigned long long int Y)
{
unsigned long long int Exp,Len;
Len=X>Y?X:Y;
Exp=1;
while (Exp<Len)
Exp*=2;
if (X==1&&Y==1)
{
return 1;
}
else if (X>Exp/2&&Y>Exp/2)
{
return (Exp*Exp/4)+Reduce(X-Exp/2,Y-Exp/2);
}
else if (X>Exp/2&&Y<=Exp/2)
{
return 2*(Exp*Exp/4)+Reduce(X-Exp/2,Y);
}
else if(X<=Exp/2&&Y>Exp/2)
{
return 3*(Exp*Exp/4)+Reduce(X,Y-Exp/2);
}
}
int main()
{
unsigned long long int I,J;
scanf("%llu%llu",&I,&J);
printf("%llu\n",Reduce(J,I));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPG1hdGguaD4KdW5zaWduZWQgbG9uZyBsb25nIGludCBSZWR1Y2UodW5zaWduZWQgbG9uZyBsb25nIGludCBYICx1bnNpZ25lZCBsb25nIGxvbmcgaW50IFkpCnsKICAgIHVuc2lnbmVkIGxvbmcgbG9uZyBpbnQgRXhwLExlbjsKICAgIExlbj1YPlk/WDpZOwogICAgRXhwPTE7CiAgICB3aGlsZSAoRXhwPExlbikKICAgICAgICBFeHAqPTI7CiAgICBpZiAgICAgIChYPT0xJiZZPT0xKQogICAgewogICAgICAgIHJldHVybiAxOwogICAgfQogICAgZWxzZSBpZiAoWD5FeHAvMiYmWT5FeHAvMikKICAgIHsKICAgICAgICByZXR1cm4gKEV4cCpFeHAvNCkrUmVkdWNlKFgtRXhwLzIsWS1FeHAvMik7CiAgICB9CiAgICBlbHNlIGlmIChYPkV4cC8yJiZZPD1FeHAvMikKICAgIHsKICAgICAgICByZXR1cm4gMiooRXhwKkV4cC80KStSZWR1Y2UoWC1FeHAvMixZKTsKICAgIH0KICAgIGVsc2UgaWYoWDw9RXhwLzImJlk+RXhwLzIpCiAgICB7CiAgICAgICAgcmV0dXJuIDMqKEV4cCpFeHAvNCkrUmVkdWNlKFgsWS1FeHAvMik7CiAgICB9Cn0KaW50IG1haW4oKQp7CiAgICB1bnNpZ25lZCBsb25nIGxvbmcgaW50IEksSjsKICAgIHNjYW5mKCIlbGx1JWxsdSIsJkksJkopOwogICAgcHJpbnRmKCIlbGx1XG4iLFJlZHVjZShKLEkpKTsKICAgIHJldHVybiAwOwp9Cg==