Consider an board, where every cell has a positive value. You are located at the top left cell, and you must go to the bottom right cell, never leaving the board. Every step must be made down or to the right, with one exception: you can make chess knight jumps (each, in any of the eight possible ways). Every time you pass by a cell you accumulate its value. Optimize the benefit.
Input consists of several cases. Every case begins with , and , followed by rows with natural numbers between 1 and . Assume that both and are between 3 and 100, and that is between 0 and 100.
For every case, print the maximum possible benefit.
Input
3 5 0 2 20 20 3 20 3 1 1 1 1 50 2 5 1 4 3 5 1 2 20 20 3 20 3 1 1 1 1 50 2 5 1 4
Output
70 130