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
//Maximum Sum Sequence ?
#include<bits/stdc++.h>
using namespace std;
#define INF 100000

int n;
vector<vector<int> > a;
int v[100][100];//a_11を左上、a_ijを右下とする四角形内部の数字の和
int ans=-INF;

int main(){
  cin>>n;
  for(int i=0; i<n; i++){
    vector<int> tmp;
    for(int j=0; j<n; j++){
      int t;
      cin>>t;
      tmp.push_back(t);
    }
    a.push_back(tmp);
  }

  while(!a.empty()){
    /*
    cout<<"a"<<endl;
    for(int i=0; i<n; i++){
      for(int j=0; j<n; j++)
        cout<<a[i][j]<<' ';
      cout<<endl;
    }
    cout<<endl;
    */
    v[0][0]=a[0][0];
    for(int i=1; i<n; i++){
      v[i][0]=v[i-1][0]+a[i][0];//左側
      v[0][i]=v[0][i-1]+a[0][i];//上側
    }
    for(int i=1; i<n; i++)
      for(int j=1; j<n; j++)
        v[i][j]=v[i-1][j]+v[i][j-1]-v[i-1][j-1]+a[i][j];

    for(int i=0; i<n; i++)
      for(int j=0; j<n; j++)
        if(ans<v[i][j])ans=v[i][j];
    /*
    cout<<"v"<<endl;
    for(int i=0; i<n; i++){
      for(int j=0; j<n; j++)
        cout<<v[i][j]<<' ';
      cout<<endl;
    }
    cout<<endl;
    */
    //行方向
    for(int i=0; i<n; i++){
      int min_v=v[i][0], mx=v[i][0];
      for(int j=1; j<n; j++){
        if(mx<v[i][j]-min_v)mx=v[i][j]-min_v;
        if(min_v>v[i][j]){min_v=v[i][j];}
      }
      if(ans<mx)ans=mx;
    }
    //列方向
    for(int i=0; i<n; i++){
      int min_v=v[0][i], mx=v[0][i];
      for(int j=1; j<n; j++){
        if(mx<v[j][i]-min_v)mx=v[j][i]-min_v;
        if(min_v>v[j][i]){min_v=v[j][i];}
      }
      if(ans<mx)ans=mx;
    }
    for(int i=0; i<n; i++)a[i].erase(a[i].begin());
    a.erase(a.begin());
    n--;
  }
  cout<<ans<<endl;

  return 0;
}