#include <vector>
#include <fstream>
#include <iostream>
using namespace std;
typedef vector<vector<int> > MATRIX;
typedef unsigned int uint;
int maxi;
MATRIX table;
void back_flip(vector<int> possible_solution) {
if(possible_solution.size() == table.size()) {
int sum1 = 0, sum2 = 0;
for(uint i = 0; i < table.size(); i++)
for(uint j = 0; j < table[i].size(); j++) {
sum1 += table[i][j] * possible_solution[i];
sum2 += table[i][j] * possible_solution[j];
}
if(sum1 > maxi)
maxi = sum1;
if(sum2 > maxi)
maxi = sum2;
}
else {
possible_solution.push_back(1);
back_flip(possible_solution);
possible_solution.pop_back();
possible_solution.push_back(-1);
back_flip(possible_solution);
}
}
int main() {
fstream input("flip.in", ios_base::in);
fstream output("flip.out", ios_base::out);
int n,m;
input >> n >> m;
table = vector<vector<int> >(n, vector<int>(m, 0));
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
input >> table[i][j];
maxi = INT_MIN;
vector<int> solution;
back_flip(solution);
output << maxi;
input.close();
output.close();
return 0;
}