n, m = list(map(int,input().split())) mini = min(n,m) maxi = max(n,m) count = min(mini-1 + mini*(maxi-1), maxi-1 + maxi*(mini-1)) print(count)