#C9319. Domino Tiling Full Coverage

    ID: 53399 Type: Default 1000ms 256MiB

Domino Tiling Full Coverage

Domino Tiling Full Coverage

You are given a board of size (n \times m) where (n) is the number of rows and (m) is the number of columns. Your task is to determine the minimum number of (1\times2) domino pieces required to completely cover the board. Note that if the board contains an odd number of cells (i.e. if (n \times m) is odd), it is impossible to cover it entirely with dominoes, and you should output (-1). Otherwise, the answer is (\frac{n\times m}{2}).

Example:
For a board of size 2 rows and 3 columns, the total number of cells is 6 (even), so the answer is (6/2 = 3) dominoes.

inputFormat

The input consists of a single line containing two space-separated integers (n) and (m) representing the number of rows and columns respectively. The input is provided via standard input (stdin).

outputFormat

Output a single integer which is the minimum number of (1 \times 2) domino pieces needed to completely cover the (n \times m) board, or output (-1) if it is not possible. The output should be written to standard output (stdout).## sample

2 3
3