# c行すべての場合を試す
def rec(all,a,k)
    if k == a.length
      all << a.dup
    else
      a[k] = true
      rec(all,a,k+1)
      a[k] = false
      rec(all,a,k+1)
    end
end

# ひっくり返す
def rev(ary)
  0.upto(ary.length-1) do |i|
    ary[i] = 1 - ary[i]
  end
end

loop do
  c,r = gets.split(" ").map(&:to_i)
  break if c ==0 && r ==0
  senbei = []*c
  c.times {|i| senbei[i] = gets.split(" ").map(&:to_i)}

  # c行についてはすべての場合を試す.最大で1024通り
  a = Array.new(c) {false}
  all = []
  rec(all,a,1)

  # main
  max = 0
  all.each do |col|
    cnt = 0
    # 横をひっくり返す
    c.times do |i|
      if col[i]
        rev(senbei[i])
      end
    end

    # 縦の煎餅を数える
    r.times do |i|
      cnt_zero = 0
      c.times do |j|
        cnt_zero += 1 if senbei[j][i] == 0
      end
      cnt += 2 * cnt_zero > c ? cnt_zero : c - cnt_zero
    end

    max = cnt if cnt > max

    # 横をもとに戻す
    c.times do |i|
      if col[i]
        rev(senbei[i])
      end
    end
  end

  puts max
end