# -*- coding: utf-8 -*-

require 'pp'

class Array
  def sum
    self.inject(0) {|sum, elem| sum + elem}
  end
end

def gets_nums
  $stdin.gets.chomp.split(" ").map(&:to_i)
end

def read_each_lines(&proc)
  col, row = gets_nums
  return if col == 0 and row == 0
  proc.call(col.times.map {gets_nums}, col, row)
  read_each_lines(&proc)
end

read_each_lines do |board, col, row|
  result = (0..((1 << col) - 1)).map do |i|
    board.transpose.map do |row|
      len = row.each_with_index.select {|x, c| x == ((i >> c) & 1)}.length
      [len, col - len].max
    end.sum
  end
  puts result.max
end