14090 - Domo's Treasure Hunt   

Description

Domo is a brilliant dog.

Today he comes out for a jog.

Domo likes walking in cities,

because he can earn some money.

 

The town map is M columns, N rows.

The dog departs from (0, 0)

He will collect money in town,

but he only goes right or down.

 

There'll be an int within each cell.

How much money: the number tells.

For every cell Domo visit,

he'll take the money as the "profit."

 

Domo's goal is the low-right corner.

He wants money greatest in number.

Please help Domo to inspect.

How much money can he collect?

 

 

Input

The first line consists of two positive integers M and N. (1 ≤ M, N ≤ 1024).

The next N lines, containing M integers each, represent the money in each cell. For all cells, the number of money aij, 0 ≤ aij ≤ 108.

Output

The maximum amount of money Domo can get from the city, followed by an end-line character.

Sample Input  Download

Sample Output  Download

Tags




Discuss