
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], row = line[1], result = 0;
    if (col == 0 && row == 0) return;
    int[][] table = 0.iota(col).map!(_ => read_numbers).array;
    for (int i = 0; i < (1 << col); i++) {
      int sum = 0;
      for (int r = 0; r < row; r++) {
        int row_sum = 0;
        for (int c = 0; c < col; c++) {
          int inside_out = ((i >> c) & 1);
          if (inside_out == table[c][r]) {row_sum += 1;}
        }
        if (row_sum < col - row_sum) {row_sum = col - row_sum;}
        sum += row_sum;
      }
      if (result < sum) {
        result = sum;
      }
    }
    writeln(result);
  }
}