# Enter your code here. Read input from STDIN. Print output to STDOUT n,m = map(long,raw_input().strip().split(' ')) if m==1: print (n-1) elif n==0: print 0 else: print (n*m-1)