
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.array;
import core.bitop;

int[] read_numbers() {
  return readln.strip.chomp.split(" ").map!(to!(int)).array;
}

void main() {
  int col, row;
  for(;scanf("%d%d ", &col, &row), col;) {
    auto table = new int[][](col, row);
    foreach(ref line; table) {
      line = read_numbers;
    }
    auto rows = new int[](row);
    foreach(c; 0..col) {
      foreach(r; 0..row) {
        rows[r] |= (table[c][r] << c);
      }
    }
    int ans = 0;
    foreach(bit; 0..(1 << col)) {
      auto value =
        reduce!((accum, x) {
            return accum + max(popcnt(x ^ bit), col - popcnt(x ^ bit));
          })(0, rows);
      ans = max(value, ans);
    }
    writeln(ans);
  }
}