Placing Game Pieces
Time limit1sMemory limit1024 MB
Given a board N cells wide and M cells tall, count the unordered pairs of cells that touch each other diagonally.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
The game board is cells wide and cells tall. Count the ways to place two identical game pieces on the board so that they are diagonally adjacent to each other.
The figure below shows the case , .

Input
The first line contains the width of the board.
The second line contains the height of the board.
Output
Print the number of ways to place the pieces so that the condition above is satisfied.
Hint
Every way for the first example is shown in the figure above.
In the second example, the two pieces cannot be placed diagonally adjacent to each other, so the answer is .