n,m = map(int, input().split()) if m > 1 and n > 1: if m == n: print((n-1)+((m-1)*n)) elif m > n: print((n-1)+((m-1)*n)) else: print((m-1)+((n-1)*m)) elif m == 1: print(n-1) elif n == 1: print(m-1) else: print(0)