Chess

No attempts yetTime limit1sMemory limit128 MB

Problem

Pawełek is still learning chess and is currently working on how the rook moves. So far he only knows that a rook moves horizontally: it can move to any cell in its own row, and to no other cell.

Using this knowledge, Pawełek invented his own game. He draws a square n×nn \times n board and writes one integer in each cell. Then he places some rooks on the board, trying to make the sum of the numbers on the occupied cells as large as possible. He may place any number of rooks (he can always borrow more if he needs them), and if he places none, the sum is taken to be 00.

To keep the game from being too easy, he follows one rule: no two rooks may occupy the same cell, and no two rooks may attack each other. By the rules he knows, a rook attacks along its own row, so in effect no two rooks may be placed in the same row.

Given the size of the board and the numbers written in its cells, find the largest sum Pawełek can obtain by placing rooks according to these rules.

Input

The first line contains an integer nn (1n2001 \le n \le 200), the height and width of the board. Each of the next nn lines describes one row of the board, in order: the ii-th of these lines contains nn integers separated by spaces, the values written in the cells of the ii-th row. Each integer is between 1,000,000-1{,}000{,}000 and 1,000,0001{,}000{,}000, inclusive.

Output

Print a single integer: the maximum sum Pawełek can obtain.