|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||351||195||167||56.040%|
A worm is going to eat chocolate in a form of a rectangle with M rows and N columns.
It starts eating at the upper left corner and eats the entire row to its end. It then turns clockwise and continues to eat the whole column (the last one). Upon reaching its end, the process is repeated, i.e. the worm turns clockwise and eats the entire last row. By repeating this process of eating the chocolate, worm will eat the whole chocolate.
Write a program that will compute the number of turns the worm made until it ate the whole chocolate.
The first and only line of the input contains two integers, M and N, 2 ≤ M,N ≤ 100,. separated by a space character. M is number of rows and N is number of columns.
The first and only line of output should contain the number of turns a worm needs to make until it eats the whole chocolate.