/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <fstream>
using namespace std;
int n,m,sol[32],i,j,gasit;
long a[16][16],maxim,s;
void back(int k)
{
if(k>=n+m)
{
s=0;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
if(sol[i]==sol[n+j])
s+=a[i][j];
else
s-=a[i][j];
if(!gasit or maxim <s)
{
maxim=s;
gasit=1;
}
}
else
{
back(k+1);
sol[k]=1;
back(k+1);
}
}
int main()
{
ifstream in("flip.in");
in >>n >>m;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
in >>a[i][j];
in.close();
back(0);
ofstream out("flip.out");
out <<maxim;
out.close();
return 0;
}