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
//Name: Maximum Sum Sequence II
//Level: 2
//Category: データ構造,累積和
//Note:

/**
 * 行列要素の累積和を求めておけば、任意の矩形に対して和をO(1)で計算できる。
 *
 * オーダーは O(N^4)。
 */
#include <iostream>
#include <vector>

using namespace std;

bool solve() {
    int N;
    if(!(cin >> N)) return false;
    if(!N) return false;

    vector<vector<long long>> v(N, vector<long long>(N));
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cin >> v[i][j];
        }
    }
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            if(i > 0) v[i][j] += v[i-1][j];
            if(j > 0) v[i][j] += v[i][j-1];
            if(i > 0 && j > 0) v[i][j] -= v[i-1][j-1];
        }
    }
    long long ans = -100000;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            for(int k = i; k < N; ++k) {
                for(int l = j; l < N; ++l) {
                    long long sum = v[k][l];
                    if(i > 0) sum -= v[i-1][l];
                    if(j > 0) sum -= v[k][j-1];
                    if(i > 0 && j > 0) sum += v[i-1][j-1];
                    ans = max(ans, sum);
                }
            }
        }
    }
    cout << ans << endl;
    return true;

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}