LearnPy Hub
← Arena
EasyRating 800

Breaking Chocolate

A chocolate bar has n × m squares. Each break splits one piece into two along a line. How many breaks are needed to get all the single squares?

Input

Two integers n and m (1 ≤ n, m ≤ 10⁹).

Output

The number of breaks.

Sample 1

Input
2 2
Output
3

Sample 2

Input
1 1
Output
0
solution.py
Output appears here
Breaking Chocolate · Python Arena problem · LearnPy Hub