#include<stdlib.h>
#include<stdio.h>
#define N 100

int search(int left,int right, int top, int under, int max, int temp, int a[N][N] ,int n);

int main(int argc, const char * argv[])
{
	int n;
    
    scanf("%d", &n);
	int a[N][N]={0};
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            scanf("%d" ,&a[i][j]);
        }
    }
    /*-------------*/
    int max=a[0][0];
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            int top=i;
            int under=i;
            int left=j;
            int right=j;
            int temp= a[i][j];
            temp = search(left, right, top, under, max, temp, a, n);
            if(temp>max){
                max=temp;
            }
            
            
        }
    }
    
    /*-------------*/
    printf("%d\n",max);
    
    
    
}

int search(int left,int right, int top, int under, int max, int temp, int a[N][N] ,int n){
//    int temp=0;
//    for (int i=top; i<=under; i++){
//        for(int j=left; j<=right; j++){
//            temp+= a[i][j];
//        }
//    }
    
    
    if(max<=temp){
        max=temp;
    }
    if(under != n-1){
        int temp2=0;
        for(int i=left; i<=right; i++){
            temp2+=a[under+1][i];
        }
        if(temp2>=0){
            temp+=temp2;
            max = search(left, right, top, under+1, max, temp, a,n);
        }
    }else if(right != n-1){
        int temp3=0;
        for(int i=top; i<=under; i++){
            temp3+=a[i][right+1];
        }
        if(temp3>=0){
            temp+=temp3;
            max = search(left, right+1, top, under, max, temp, a,n);
        }
    }
    
    return max;
}