package test;
public class Main{
public static void main(String[] args) {
int arr[][]= {
{6,9,8,5,9,2,4,1,8,3,9,3,8,7,8,6,8,9,4,1},
{1,7,6,1,5,8,7,6,9,6,3,1,3,1,7,5,9,2,8,4},
{3,7,3,4,7,3,4,8,3,2,6,6,2,7,4,8,3,4,8,5},
{5,3,6,7,1,2,5,6,5,5,6,1,6,7,8,6,4,7,4,3},
{1,6,1,2,1,6,8,6,9,2,7,4,3,2,3,2,9,4,7,9},
{1,3,5,4,7,4,1,3,3,4,9,9,6,2,7,7,3,4,4,7},
{2,7,9,7,9,9,4,5,9,2,9,8,4,8,8,2,4,6,8,7},
{5,3,7,7,6,9,8,3,3,4,6,8,3,8,7,9,1,3,7,9},
{5,6,4,9,3,4,2,1,3,6,5,3,6,5,7,1,7,7,4,5},
{2,1,9,2,4,3,7,9,2,9,3,8,7,2,6,1,1,3,8,2},
{9,3,9,1,9,3,5,3,2,1,6,2,4,3,5,6,1,2,7,7},
{5,4,2,9,6,1,4,4,7,6,3,9,6,9,2,5,7,7,8,8},
{9,6,2,3,3,9,7,2,5,1,3,7,9,4,7,3,2,9,3,3},
{8,1,4,4,3,4,9,4,5,3,3,1,2,9,9,3,9,9,7,5},
{6,1,1,7,1,8,8,2,9,8,8,8,7,7,5,9,3,4,9,9},
{6,1,2,1,6,8,6,8,8,9,5,7,2,1,3,4,8,5,2,2},
{5,5,4,8,5,3,4,5,9,5,9,2,9,4,7,2,6,8,9,6},
{3,2,1,2,4,9,6,3,3,1,8,2,4,2,5,5,4,9,2,2},
{1,3,5,9,3,6,4,7,1,9,1,9,3,4,2,7,2,6,9,6},
{5,6,4,3,6,8,9,5,9,4,4,9,1,9,8,9,9,2,4,6}
};
int max=-1;
for(int i=0;i<16;i++) {
for(int j=0;j<16;j++) {
int ans=0;
ans+=arr[i][j];
ans+=arr[i][j+1];
ans+=arr[i][j+2];
ans+=arr[i][j+3];
ans+=arr[i][j+4];
ans+=arr[i+1][j];
ans+=arr[i+1][j+1];
ans+=arr[i+1][j+2];
ans+=arr[i+1][j+3];
ans+=arr[i+1][j+4];
ans+=arr[i+2][j];
ans+=arr[i+2][j+1];
ans+=arr[i+2][j+2];
ans+=arr[i+2][j+3];
ans+=arr[i+2][j+4];
ans+=arr[i+3][j];
ans+=arr[i+3][j+1];
ans+=arr[i+3][j+2];
ans+=arr[i+3][j+3];
ans+=arr[i+3][j+4];
ans+=arr[i+4][j];
ans+=arr[i+4][j+1];
ans+=arr[i+4][j+2];
ans+=arr[i+4][j+3];
ans+=arr[i+4][j+4];
max=Math.max(ans, max);
}
}
System.out.print(max);
}
}