Chess has always been a legendary discipline with a variety of pieces, such as bishops, rooks, king, queen, knights, and pawns. Each of these pieces has defined movements, and this time we will talk about the bishop. We will have a board with $$$n$$$ rows and $$$m$$$ columns where we will launch a bishop from the upper left corner, and in this case, the bishop will always go until it touches the edge of the board (it bounces on the edges). Let's see the following examples:
For $$$n=4$$$ , $$$m=6$$$
And so on
Therefore the number of squares that were not visited is 12.
Now for the case For $$$n=5$$$ , $$$m=5$$$
Therefore the number of squares that were not visited is 20.
The input consists of multiple test cases, each on a separate line.
Each case contains two integers $$$n, m$$$ $$$(2 \leq n,m \leq 10^9)$$$ indicating the dimensions of the chessboard. The total number of test cases is less than $$$5\cdot 10^4$$$.
For each case, print an integer with the number of squares not visited by the super bishop.
4 6 5 5
12 20
| Название |
|---|


