// // Created by cteam37 on 10/19/24. // #include #include using namespace std; int main() { int n,m; cin >> n; cin >> m; int totalSum = 0; int min = INT32_MAX; vector> fields; for (int row = 0; row < n; ++row) { fields.push_back({}); for (int col = 0; col < m; ++col) { int val; cin >> val; fields[row].push_back(val); totalSum += val; if (val < min) min = val; } } if(n%2 == 0 && m%2 == 0) { cout << totalSum - min << endl; } else { cout << totalSum << endl; } return 0; }