A worm is going to eat a rectangular chocolate bar with M rows and N columns.
The worm starts in the upper-left cell and first moves to the right, eating the entire top row. Then it turns 90 degrees clockwise and eats the last column downward. It keeps repeating this pattern, turning clockwise and eating the remaining outermost row or column. Eventually, the worm eats the whole chocolate bar in a spiral.
Find how many times the worm changes direction before the whole chocolate bar is eaten.
The first line contains two integers M and N separated by a space. M is the number of rows, and N is the number of columns.
2 ≤ M, N ≤ 100
Print the number of direction changes the worm makes before eating the entire chocolate bar.