Matrix of given integers


a1,1 a1,2 ... a1, n
a2,1 a2,2 ... a2, n
::
an, 1 an, 2 ... an, n


Then, create a program that outputs the maximum value of the sum of one or more consecutive terms (submatrix) in the vertical and horizontal directions and ends.



Input

The input data is given in the following format.


n
a1,1 a1,2 ... a1, n
a2,1 a2,2 ... a2, n
::
an, 1 an, 2 ... an, n


n is 1 or more and 100 or less, and ai, j is -10000 or more and 10000 or less.

Output

Print the maximum value on one line.

Examples

Input

3
1 -2 3
-4 5 6
7 8 -9


Output

16


Input

4
1 3 -9 2
2 7 -1 5
-8 3 2 -1
5 0 -3 1


Output

15
#include <iostream>

using namespace std;

int data1[101][101] = {};
int data2[101][101] = {};
int data3[101][101] = {};

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      cin >> data1[i][j];

  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      data3[i][j] = data2[i][j] =
          data1[i][j] + data2[i - 1][j] + data2[i][j - 1] - data2[i - 1][j - 1];

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 0; k <= i; ++k) {
        for (int l = 0; l <= j; ++l) {
          int v;
          if (k == i && l == j)
            break;
          else if (k == i || l == j)
            v = data2[i][j] - data2[k][l];
          else
            v = data2[i][j] - data2[k][j] - data2[i][l] + data2[k][l];
          if (data3[i][j] < v)
            data3[i][j] = v;
        }
      }
    }
  }

  int maxv = data1[1][1];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (maxv < data3[i][j])
        maxv = data3[i][j];

  cout << maxv << endl;
}
