There is a grid with $$$n$$$ rows and $$$m$$$ columns, where the rows are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns are numbered from $$$1$$$ to $$$m$$$ from left to right. The value of the cell in the $$$i$$$-th row and $$$j$$$-th column is $$$w_{i,j}$$$.
Now you can use any number (include zero) of tiles of size $$$1\times k$$$ to cover this grid. The tiles can be rotated, and $$$k$$$ can be any positive integer, but cannot exceed the grid boundaries. Each tile can have a different $$$k$$$. When covering, make sure that these tiles do not overlap and do not have adjacent edges. Find the maximum sum of the values of the covered cells.
The first line contains two integers $$$n,m$$$ ($$$1\le n,m\le 18$$$), representing the size of the grid.
For next $$$n$$$ lines, the $$$i$$$-th line contain $$$m$$$ integers $$$w_{i,1},w_{i,2},\ldots,w_{i,m}$$$ ($$$|w_{i,j}|\le 10^6$$$), representing the values of the cells.
Output a single integer on a new line, representing the maximum sum of the values of the covered cells.
2 2 2 1 1 1
3
4 4 -1 2 1 -2 3 2 0 -2 -3 -2 0 3 2 3 0 1
15