402514: GYM100796 H Game of Corners
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
H. Game of Cornerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Alice is playing the Game of Corners. She is given a rectangular grid with n rows and m columns. During one move, Alice can choose any two previously unused cell borders that have a common point and join them in a corner (pictured). A corner can be oriented in any way.
Initially the grid is clear of corners. How many moves can Alice possibly make?
InputThe only line of the input contains two integers n and m (1 ≤ n, m ≤ 109) — the number of rows and the number of columns in the grid.
OutputOutput a single integer — the maximum number of moves Alice can make.
ExamplesInput2 3Output
8Input
1 1Output
2Note
Two corners can share a point on the grid, but cannot share a cell border.
For the first given sample, one possible arrangement of corners is: