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
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>

using namespace std;
typedef long long int lint;

#define SIZE 100

int mat[SIZE + 1][SIZE + 1] = { 0 };
int sum[SIZE + 1] = { 0 };

void print(int n) {
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			printf("%4d", mat[i][j]);
		}
		cout << endl;
	}
}

//Kadane's algorithm
int max_subarray(int n) {
	int max_ending_here, max_so_far;
	max_ending_here = max_so_far = sum[1];
	for (int i = 2; i <= n; i++) {
		max_ending_here = max(sum[i], max_ending_here + sum[i]);
		max_so_far = max(max_so_far, max_ending_here);
	}
	return max_so_far;
}

void AOJ0098() {
	int n;
	cin >> n;

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

	//print(n);

	//?????????????´???????????¨????
	for (int j = 1; j <= n; j++) {
		for (int i = 1; i <= n; i++) {
			mat[i][j] += mat[i - 1][j];
		}
	}

	//print(n);

	//i1 ?????¨ i2 ????????????????????????
	//	1	3	-9	2
	//	3	10	-10	7	i1
	//	-------------
	//	-5	13	-8	6
	//	0	13	-11	7	i2
	//	-------------

	int max_sub_matrix = -1e9;
	for (int i1 = 0; i1 < n; i1++) {
		for (int i2 = i1 + 1; i2 <= n; i2++) {
			for (int j = 1; j <= n; j++) {
				sum[j] = mat[i2][j] - mat[i1][j];
			}
			//maximum sum sequence ?????????
			int max_sum_sequence = max_subarray(n);
			if (max_sub_matrix < max_sum_sequence) max_sub_matrix = max_sum_sequence;
		}
	}
	cout << max_sub_matrix << endl;
	return;
}

int main()
{
	AOJ0098();
	return 0;
}