import java.util.Scanner

object Main {

  def check2(num: Int, input: Array[Array[Int]]): Int = {
    Array.tabulate(input(0).length)(
      j => {
        val N = Array.tabulate(input.length)(i => if ((num >> i) % 2 == 1) input(i)(j) else (1 - input(i)(j))).view.count(k => 0 == k)
        math.max(N, input.length - N)
      }
    ).view.sum
  }

  def make(input: Array[Array[Int]]): Int = {
    Array.tabulate(1 << input.length)(i => check2(i, input)).view.max
  }

  def solve(sc: Scanner): Unit = {
    val R: Int = sc.nextInt
    val C: Int = sc.nextInt
    if (R != 0 && C != 0) {
      println(make(Array.fill(R)(Array.fill(C)(sc.nextInt))))

      solve(sc)
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}