height, width = gets.split.map &:to_i

c = []
(0...height).each do |i|
  c[i] = gets.split.map &:to_i
end

h = Array.new(height).map { Array.new(width) }

(0...height).each do |i|
  (0...width).each do |j|
    if i == 0
      h[i][j] = c[i][j] == 0 ? 1 : 0
    else
      if c[i][j] == 1
        h[i][j] = 0
      else
        h[i][j] = h[i-1][j] + 1
      end
    end
  end
end

stack = []
max = 0

class Rect
  attr_accessor :h, :pos

  def initialize(h, pos)
    @h, @pos = h, pos
  end
end

(0...height).each do |i|
  (0...width).each do |j|
    if stack.empty?
      stack.push Rect.new(h[i][j], j)
    else
      if stack[-1].h < h[i][j]
        stack.push Rect.new(h[i][j], j)
      elsif stack[-1].h > h[i][j]
        pos = j
        while !stack.empty? && stack[-1].h >= h[i][j]
          r = stack.pop
          area = r.h * (j - r.pos)
          max = max > area ? max : area
          pos = r.pos
        end
        stack.push Rect.new(h[i][j], pos)
      end
    end
  end
end