n,m = input().strip().split(' ') n,m = [int(n),int(m)] # total number of ways to split will come out to be nXm - 1 res=n*m -1 if(m==0): print(0) else: print(res)