Reminder: in case of any technical issues, you can use lightweight websites
m1.codeforces.com,
m2.codeforces.com or
m3.codeforces.com
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Relay Race

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputFurik and Rubik take part in a relay race. The race will be set up on a large square with the side of *n* meters. The given square is split into *n* × *n* cells (represented as unit squares), each cell has some number.

At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with coordinates (*n*, *n*). Right after the start Furik runs towards Rubik, besides, if Furik stands at a cell with coordinates (*i*, *j*), then he can move to cell (*i* + 1, *j*) or (*i*, *j* + 1). After Furik reaches Rubik, Rubik starts running from cell with coordinates (*n*, *n*) to cell with coordinates (1, 1). If Rubik stands in cell (*i*, *j*), then he can move to cell (*i* - 1, *j*) or (*i*, *j* - 1). Neither Furik, nor Rubik are allowed to go beyond the boundaries of the field; if a player goes beyond the boundaries, he will be disqualified.

To win the race, Furik and Rubik must earn as many points as possible. The number of points is the sum of numbers from the cells Furik and Rubik visited. Each cell counts only once in the sum.

Print the maximum number of points Furik and Rubik can earn on the relay race.

Input

The first line contains a single integer (1 ≤ *n* ≤ 300). The next *n* lines contain *n* integers each: the *j*-th number on the *i*-th line *a*_{i, j} ( - 1000 ≤ *a*_{i, j} ≤ 1000) is the number written in the cell with coordinates (*i*, *j*).

Output

On a single line print a single number — the answer to the problem.

Examples

Input

1

5

Output

5

Input

2

11 14

16 12

Output

53

Input

3

25 16 25

12 18 19

11 13 8

Output

136

Note

Comments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1).

Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample:

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/26/2019 17:49:28 (e3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|