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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int main(){
    int n;
    cin >> n;
    vector<vector<int>> sum(n + 1, vector<int>(n + 1, 0));
    REP(i, n){
        int sum_tmp = 0;
        REP(j, n){
            int tmp;
            cin >> tmp;
            sum_tmp += tmp;
            sum[i + 1][j + 1] = sum[i][j + 1] + sum_tmp;
        }
    }
    int ans = -inf;
    REP(i, n + 1) REP(j, n + 1) REP(k, i) REP(l, j){
        int tmp = sum[i][j] - sum[i][l] - sum[k][j] + sum[k][l];
        // cout << tmp << endl;
        if(ans < tmp) ans = tmp;
    }
    cout << ans << endl;
}
