Donghyuk has a rectangular chessboard. Its rows and columns are numbered from 0. The cell in row i and column j is black when i+j is even and white when i+j is odd. Some cells of the board hold a piece.
Yunho has a very large supply of L-shaped tiles. One tile is three squares, each the size of a board cell, joined as in the picture below.
OO
O
Yunho wants to lay tiles on the board under the following rules.
- A tile can be rotated by 90, 180, or 270 degrees.
- One tile must cover three cells of the board.
- Two tiles must not overlap.
- A tile cannot cover a cell that holds a piece.
- The corner cell of a tile, the one that touches both of the other two squares, must cover a black cell.
Write a program that finds the largest number of tiles Yunho can lay.