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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();
		
		int[][] matrix = new int[n][n];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				matrix[i][j] = sc.nextInt();
			}
		}
		
		int[][] sum = new int[n + 2][n + 2];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i == 0 && j == 0){
					sum[i][j] = matrix[i][j];
				}else if(i == 0){
					sum[i][j] = sum[i][j-1] + matrix[i][j];
				}else if(j == 0){
					sum[i][j] = sum[i-1][j] + matrix[i][j];
				}else{
					sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + matrix[i][j];
				}
			}
		}
		
		int max = Integer.MIN_VALUE;
		for(int e_y = 0; e_y < n; e_y++){
			for(int e_x = 0; e_x < n; e_x++){
				
				for(int s_y = e_y - 1; s_y >= 0; s_y--){
					for(int s_x = e_x - 1; s_x >= 0; s_x--){
						max = Math.max(max, sum[e_y][e_x] - sum[s_y][e_x] - sum[e_y][s_x] + sum[s_y][s_x]);
					}
					
					max = Math.max(max, sum[e_y][e_x] - sum[s_y][e_x]);
				}
				
				for(int s_x = e_x - 1; s_x >= 0; s_x--){
					max = Math.max(max, sum[e_y][e_x] - sum[e_y][s_x]);
				}
				
				max = Math.max(max, sum[e_y][e_x]);
				
			}
		}
		
		System.out.println(max);
	}
	
	public static class Scanner {
		
		private BufferedReader br;
		private StringTokenizer tok;
		
		public Scanner(InputStream is) throws IOException{
			br = new BufferedReader(new InputStreamReader(is));
			getLine();
		}
		
		private void getLine() throws IOException{
			tok = new StringTokenizer(br.readLine());
		}
		
		private boolean hasNext(){
			return tok.hasMoreTokens();
		}
		
		public int nextInt() throws IOException{
			if(hasNext()){
				return Integer.parseInt(tok.nextToken());
			}else{
				getLine();
				return Integer.parseInt(tok.nextToken());
			}
		}
		
		public long nextLong() throws IOException{
			if(hasNext()){
				return Long.parseLong(tok.nextToken());
			}else{
				getLine();
				return Long.parseLong(tok.nextToken());
			}
		}
		
		public double nextDouble() throws IOException{
			if(hasNext()){
				return Double.parseDouble(tok.nextToken());
			}else{
				getLine();
				return Double.parseDouble(tok.nextToken());
			}
		}
	}
}