Limits 1s, 512 MB

The Great Researcher Mr. Bari will give you some chocolates from Singapore if you can solve the following problem.

You are given an n*n array. You have to find out in which direction the maximum sum of numbers is located. Is it through any row, or any column or one of the two diagonals?

Input

First you will take an integer number n(1≤n≤100) as input. In the following n lines, you will take n numbers as input in each of the lines. The numbers will be in range [-100, 100].

Output

Compute the value of maximum sum of numbers through any direction(row wise or column wise or diagonally).

Sample

InputOutput
3
1 2 3
4 5 6
7 8 9
24

In the sample, maximum sum of numbers is through the last row which is 24.

Submit

Login to submit.

Statistics

87% Solution Ratio
MU_SubMairaDkhEarliest, May '18
rogue_33Fastest, 0.0s
shoumoLightest, 131 kB
touhidurrrShortest, 201B
Toph uses cookies. By continuing you agree to our Cookie Policy.