import java.util.Scanner

object Main {

  def check2(num: Int, input: => Array[Array[Boolean]]): Int = {
    var ans = 0
    for (j <- 0 until input(0).length) {
      ans += {
        var N = 0
        for (i <- 0 until input.length) {
          N += (if (if ((num >> i) % 2 == 1) input(i)(j) else !(input(i)(j))) 0 else 1)
        }
        math.max(N, input.length - N)
      }
    }
    ans
  }

  def make(R: Int, C: Int, sc: => Scanner): Int = {
    val input: Array[Array[Boolean]] = Array.fill(R)(Array.fill(C)(sc.nextInt == 1))
    (0 until 1 << (R - 1)).foldLeft(0)((acc, i) => math.max(acc, check2(i, input)))
  }

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

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