#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int s[33][51][51],f[33];
int main(void)
{
freopen("matrix.in","r",stdin);
freopen("matrix.out","w",stdout);
int i,j,k,i2,j2,h,n,m,temp,maxnum=0;
cin>>h>>n>>m;
for (i=1;i<=h;i++)
for (j=1;j<=n;j++)
for (k=1;k<=m;k++)
{
cin>>temp;
s[i][j][k]=s[i][j-1][k]+s[i][j][k-1]-s[i][j-1][k-1]+temp;
}
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
for (i2=i;i2<=n;i2++)
for (j2=j;j2<=m;j2++)
for (k=1;k<=h;k++)
{
f[k]=f[k-1]+s[k][i2][j2]-s[k][i2][j-1]-s[k][i-1][j2]+s[k][i-1][j-1];
if (f[k]<0)
f[k]=0;
if (maxnum<f[k])
maxnum=f[k];
}
cout<<maxnum<<endl;
return(0);
}