Vogons

We all know the Vogons: A race of detestable aliens of Vogosphere planet, very similar to slugs but with a couple of humanoid characteristics, corpulent and with green skin. We all know too that they are the more bureaucratic characters of the space, the third worst poets of the universe and finally we all know that they have been commissioned to destroy the earth in order to build an intergalactic road. What is not so well known is that the Vogons had prepared their tools to extract all the gold from the earth while they can. However, their tool is anything but sophisticated and instead of collect the gold and then destroy the earth, does both things at the same time, destroying a lot of gold before being collected. A gold mine can be represented as a rectangular grid, where each square has an amount of gold g. When a Vogon’s ship lands over the mine does the following process: • Select a square not destroyed. • Extract all the gold from the selected square. • Destroy the selected square. • Destroy the upper and lower square without extract the gold. • Destroy all the squares from the right and left column of the selected square without extract the gold. Once the square is destroyed, there is no gold anymore in the square. Vogon’s will keep repeating this process over and over again until all the mine has been destroyed. What is the maximum amount of gold they can extract? Input Input contains several test cases. Each test contains two integers n and m (1 ≤ n,m ≤ 300), the number of rows and columns that conforms the mine. Following there are n lines with m integers gi,j (1 ≤ gi,j ≤ 2000) representing the amount of gold in each square of the mine. Output Print a single line per test case, the maximum amount of gold that Vogons can extract. Sample Input 44 10 1 1 10 1541 1451 10 1 1 10 Sample Output 40