Breaking Chocolate
An N×M chocolate bar must be broken into its N·M unit squares; each break splits ONE piece along a line. How many breaks are needed?
Input: one line with two integers N and M.
Output: N·M − 1.
Constraints:
- 1 ≤ N, M ≤ 109
Sample Tests
Input 1
2 3
Output 1
5
Input 2
1 1
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.