#include <stdio.h>
FILE *fin, *fout;
long int suma(long int s[16][16],int x,int y)
{ int fi,fj;
long int fsuma=0;
for(fi=0;fi<x;fi++)
for(fj=0;fj<y;fj++)
fsuma+=s[fi][fj];
return fsuma;
}
int main()
{long int a[16][16],b[16][16],k[16][16],stot;
int m,n,i,j,o,g,h;
fin=fopen("filip.in","r");
fout=fopen("filip.out","w");
fscanf(fin,"%d",&m);
fscanf(fin,"%d",&n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{fscanf(fin,"%d",&a[i][j]);
b[i][j]=a[i][j]*-1;
}
stot=suma(a,m,n)>suma(b,m,n)?suma(a,m,n):suma(b,m,n);
for(o=1;o<=2;o++)
for(i=0;i<m;i++)
{ if(o==1){for(g=0;g<m;g++)
for(h=0;h<n;h++)
k[g][h]=a[g][h];
}
for(j=0;j<n;j++)
{k[i][j]=k[i][j]*-1;}
if(suma(k,m,n)>stot) stot=suma(k,m,n);
}
for(o=1;o<=2;o++)
for(i=0;i<m;i++)
{ if(o==1){for(g=0;g<m;g++)
for(h=0;h<n;h++)
k[g][h]=b[g][h];
}
for(j=0;j<n;j++)
{k[i][j]=k[i][j]*-1;}
if(suma(k,m,n)>stot) stot=suma(k,m,n);
}
for(o=1;o<=2;o++)
for(i=0;i<m;i++)
{ if(o==1){for(g=0;g<m;g++)
for(h=0;h<n;h++)
k[g][h]=a[g][h];
}
for(j=0;j<n;j++)
{k[j][i]=k[j][i]*-1;}
if(suma(k,m,n)>stot) stot=suma(k,m,n);
}
for(o=1;o<=2;o++)
for(i=0;i<m;i++)
{ if(o==1){for(g=0;g<m;g++)
for(h=0;h<n;h++)
k[g][h]=b[g][h];
}
for(j=0;j<n;j++)
{k[j][i]=k[j][i]*-1;}
if(suma(k,m,n)>stot) stot=suma(k,m,n);
}
fprintf(fout,"%d",stot);
}