
import std.stdio;
import std.range;
import std.conv;
import std.string;
import std.algorithm;

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

int arr_max(int[] arr) {
  return arr.reduce!(max);
}

int arr_sum(int[] arr) {
  return arr.reduce!((x, accum) => x + accum);
}

void main() {
  while (true) {
    auto line = read_numbers;
    int col = line[0];
    int row = line[1];
    if (col == 0 && row == 0) return;
    int[][] table = 0.iota(col).map!(_ => read_numbers).array;
    0.iota(1 << col).map!
      ((i) {
        return 0.iota(row).map!
          ((r) {
            int col_sum = 0.iota(col).map!
              ((c) {
                int inside_out = ((i >> c) & 1);
                if (inside_out == table[c][r])
                  return 0;
                else
                  return 1;
              }).count!(x => x == 0).to!(int);
            if (col_sum < col - col_sum) col_sum = col - col_sum;
            return col_sum;
          }).array.arr_sum;
      }).array.arr_max.writeln;
  }
}