Question
Grid Flip

Zara selects a finite N x M grid, initially filled with zeros. She performs an operation on each cell, flipping the cell and its eight neighbors (from 0 to 1 or 1 to 0). After applying this operation to every cell, compute the total number of 1s in the grid.

Input
The first and only line of input contains two space-separated integers N and M.
Output
Print an integer representing the total number of 1s in the grid.
Example
Sample Input
3 3
Sample Output
1
Explanation
After all the 9 operations, only the element at (2, 2) in this grid (1-indexed) will have value 1.

Online