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

require 'pp'

class Array
  def product
    self.inject(1) {|sum, elem| sum * elem}
  end
  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)
  n, m = gets_nums
  return if n == 0 and m == 0
  proc.call(n.times.map {gets_nums})
  read_each_lines(&proc)
end

# 0 の数を数える
def counter(board)
  count = 0
  board.transpose.map do |line|
    (line.partition {|x| x == 0}).map(&:length).max
  end.sum
end

def flip_col(board, n)
  arr = board[n]
  arr.each_with_index do |item, index|
    arr[index] = ((arr[index] == 0) ? 1 : 0)
  end
  board
end

def search_max_count(board, n)
  if n == board.length - 1 then
    # pp board, counter(board)
    return counter(board)
  end
  [search_max_count(flip_col(board, n), n + 1), search_max_count(board, n + 1)].max
end

read_each_lines do |board|
  # pp board
  # pp counter(board)
  puts search_max_count(board, 0)
end