A Turtle sits in the upper left corner of a rectangular field of size N x M. She wants to paint some cells in a spiral that twists towards the center, as in the picture:
Decide how many cells she will have to paint over.
Input
The first line of the input contains the number N — the height of the rectangle, the second line contains the number M — the width of the rectangle. All numbers — are positive integers and do not exceed 2 × 10
9.
Imprint
The program should output a single integer — the number of cells filled by the Turtle.
Please note that the answer in this problem may exceed the possible value of a 32-bit integer variable, so you must use 64-bit integer data types (int64 type in Pascal, long long type in C++, long type in Java, and C#).
Examples
# |
Input |
Output |
1 |
5
6 |
20 |
2 |
1
5 |
5 |