N,M=map(int, input().split()) if N==1: print(0) exit() if N%2==0: print(M*N) exit() ans=0;c=0 for i in range(29,-1,-1): if M&(1<