type smen=record neg,poz:integer; end;
var fi,fo:text;
n,m,i,j,slin,scol,max1,max2:longint;
a,aux:array[1..100,1..100] of longint;
lin,col:array[1..100] of smen;
procedure invcol(x:integer);
var i:integer;
begin
for i:=1 to n do
aux[i,x]:=-aux[i,x];
end;
procedure invlin(x:integer);
var j:integer;
begin
for j:=1 to m do
aux[x,j]:=-aux[x,j];
end;
function sumcol2(x:integer):longint;
var sum,j:longint;
begin
sum:=0;
for i:=1 to n do
if a[i,x]<0 then sum:=sum+a[i,x];
sumcol2:=sum;
end;
function sumcol1(x:integer):longint;
var sum,j:longint;
begin
sum:=0;
for i:=1 to n do
if a[i,x]>=0 then sum:=sum+a[i,x];
sumcol1:=sum;
end;
function sumlin2(x:integer):longint;
var sum,j:longint;
begin
sum:=0;
for j:=1 to m do
if a[x,j]<0 then sum:=sum+a[x,j];
sumlin2:=sum;
end;
function sumlin1(x:integer):longint;
var sum,j:longint;
begin
sum:=0;
for j:=1 to m do
if a[x,j]>=0 then sum:=sum+a[x,j];
sumlin1:=sum;
end;
function suma:longint;
var i,j:integer;
sum:longint;
begin
sum:=0;
for i:=1 to n do
for j:=1 to m do
sum:=sum+aux[i,j];
suma:=sum;
end;
procedure gosolve;
begin
for i:=1 to n do
begin
lin[i].poz:=sumlin1(i);
lin[i].neg:=sumlin2(i);
end;
for j:=1 to m do
begin
col[j].poz:=sumcol1(j);
col[j].neg:=sumcol2(j);
end;
for i:=1 to n do
for j:=i to m do
begin
if col[i].poz<abs(col[i].neg) then invcol(i);
if lin[j].poz<abs(lin[j].neg) then invlin(j);
if suma>max1 then max1:=suma;
end;
aux:=a;
for i:=1 to m do
for j:=i to n do
begin
if col[j].poz<abs(col[j].neg) then invcol(j);
if lin[i].poz<abs(lin[i].neg) then invlin(i);
if suma>max1 then max1:=suma;
end;
writeln(fo,max1);
end;
begin
assign(fi,'flip.in'); reset(fi);
assign(fo,'flip.out'); rewrite(fo);
readln(fi,n,m);
for i:=1 to n do
for j:=1 to m do
begin
read(fi,a[i,j]);
aux[i,j]:=a[i,j];
end;
gosolve;
{ for i:=1 to n do
write(fo,lin[i].poz,'/',lin[i].neg,' ');
writeln(fo);
for i:=1 to m do
write(fo,col[i].poz,'/',col[i].neg,' ');
}
close(fi);
close(fo);
end.