Maximum Sum basic
A rectangular table of size rows by columns is given. Each cell of this table contains one integer. You can traverse the table from top to bottom, starting from any cell in the top row, and at each step, move to one of the "lower neighboring" cells. In other words, from a cell with coordinates , you can move to , , or . If , the last of the three movement options is not possible. If , the first option is not possible. The route ends in one of the cells of the bottom row.
Write a program that finds the maximum possible sum of values of cells passed along any valid path.
Input
The first line contains and — the number of rows and columns. Each of the next lines contains integers (with absolute values not exceeding ) — the values of the cells in the table.
Output
Print one single integer — the maximum possible sum.