Problem 3 : Paper Cutting



Problem

You are given a paper of dimension m*n, and you have to cut into m*n squares each of dimension 1*1 using a scissors. What is the minimum number of cuts needs to get all m*n squares?

Input

Input consists of several test cases. Each case appears on a single line, and there is no blank line between two cases. Each line has two numbers m and n, indicating the dimension of the paper. The input is terminated by the case m=0 and n=0. You do not have to handle this case. Both m and n will fit in a 32-bit integer representation.

Output

For each input, output the minimum number of cuts needed, as specified above.

Sample Input

2 2
1 1
5 1
0 0

Sample Output

3
0
4