You are given a grid of n rows and m columns consisting of lowercase English letters a, b, c, and d.
We say 4 cells form a "nice-quadruple" if and only if
A cell (x2,y2) is said to be directly reachable from cell (x1,y1) if and only if (x2,y2) is one of these 4 cells { (x1−1,y1), (x1+1,y1), (x1,y1−1) and (x1,y1+1)}).
Given the constraint that each cell can be part of at most 1 "nice-quadruple", what's the maximum number of "nice-quadruples" you can select?
Input format
Output format
Output the maximum number of "nice-quadruple" you can select.
Constraints
1≤n,m≤20
Let (i,j) represent the cell in row i and column j.(considering (1,1) as the top left of the grid.) Then the set of cells {(1,2), (1,3), (2,2),(2,3)} form one "nice-quadraple" and the set of cells {(1,4), (1,5), (1,6),(1,7)} form another "nice-quadraple". You can verify that you cannot get more than 2 "nice-quadraple" .