pp = input().split(' ') n = int(pp[0]) m = int(pp[0]) q1 = (m-1) + m*(n-1) q2 = (n-1) + n*(m-1) q = q1 if q1 < q1 else q1 print(q)