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 c[i][j] == 1
      h[i][j] = 0
    else
      h[i][j] = i > 0 ? h[i-1][j] + 1 : 1
    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|
  h[i][width] = 0
  (0..width).each do |j|
    rect = Rect.new(h[i][j], j)
    if stack.empty?
      stack.push rect
    else
      if stack[-1].h < rect.h
        stack.push rect
      elsif stack[-1].h > rect.h
        pos = j
        while !stack.empty? && stack[-1].h >= rect.h
          pre = stack.pop
          area = pre.h * (j - pre.pos)
          max = max > area ? max : area
          pos = pre.pos
        end
        rect.pos = pos
        stack.push rect
      end
    end
  end
end

puts max