import java.util.Scanner

object Main {

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

  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)).view.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)
  }
}