#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
int n,m,i,j,k,l,h,ans,tmp,x,minn;
int a[60][60][60];
int f[60][60][60][60];
int main()
{
freopen("matrix.in","r",stdin);
freopen("matrix.out","w",stdout);
scanf("%d%d%d",&h,&n,&m);
for (int k=1;k<=h;k++){
for (int i=1;i<=n;i++)
{
for (int j=1;j<=m;j++)
{
scanf("%d",&x);
a[i][j][k]=a[i-1][j][k]+a[i][j-1][k]+a[i][j][k-1]-a[i-1][j-1][k]-a[i][j-1][k-1]-a[i-1][j][k-1]+a[i-1][j-1][k-1]+x;
x=0;
}
}
}
for (int i=1;i<=n;i++)
for (int j=i;j<=n;j++)
for (int k=1;k<=m;k++)
for (int l=k;l<=m;l++){
int minn=0;
f[i][j][k][l]=0;
for (int x=1;x<=h;x++){
tmp=a[j][l][x]-a[i-1][l][x]-a[j][k-1][x]+a[i-1][k-1][x];
if (tmp-minn>f[i][j][k][l])
f[i][j][k][l]=tmp-minn;
if (tmp<minn)
minn=tmp;
}
if (f[i][j][k][l]>ans) ans=f[i][j][k][l];
}
printf("%d",ans);
return 0;
}