#C6795. Chocolate Breaks
Chocolate Breaks
Chocolate Breaks
You are given a rectangular chocolate bar with dimensions M x N. Your task is to determine the minimum number of breaks required to separate the chocolate bar into individual 1x1 square pieces. In each break, you can split one piece along a straight line (either horizontally or vertically) between the squares.
The optimal strategy always requires breaks equal to $$M \times N - 1$$. For example, a 2x2 chocolate bar requires 3 breaks, while a 1x1 chocolate bar requires no break at all.
inputFormat
The input consists of a single line containing two space-separated integers M and N (1 ≤ M, N ≤ 109), representing the number of rows and columns of the chocolate bar respectively.
outputFormat
Output a single integer representing the minimum number of breaks required to divide the chocolate bar into individual 1x1 squares.
## sample2 2
3