A,B=map(int,input().split()) K=32 W=1 T=[[1,2],[0,1]] for _ in range(K): W*=T[A&1][B&1] A>>=1 B>>=1 print((W+1)//2)