import scala.io.StdIn

object Main extends App {

  val Array(h, w) = StdIn.readLine().split(' ').map(_.toInt)

  val tiles = (0 until h).map(_ => StdIn.readLine().split(' ')).toArray
  val square = Array.fill[Int](h, w)(1)

  (0 until h).foreach { i =>
    (0 until w).foreach { k =>
      square(i)(k) = if (tiles(i)(k) == "1") {
        0
      } else if (i == 0) {
        square(i)(k)
      } else {
        square(i - 1)(k) + 1
      }
    }
  }

  case class Rect(height: Int, pos: Int)

  def pop(lst: List[Rect], row: Array[Int], index: Int): (List[Rect], Int) = {
    lst.foldLeft((List.empty[Rect], 0)) { (acc, e) =>
      if (e.height >= row(index)) {
        (acc._1, scala.math.max(acc._2, e.height * (index - e.pos)))
      } else {
        (e :: acc._1, acc._2)
      }
    }
  }

  def loop(lst: List[Rect], row: Array[Int], index: Int): Int = {
    if (index == row.length) {
      pop(lst, row, index - 1)._2
    } else if (lst.isEmpty || lst(0).height < row(index)) {
      loop(Rect(row(index), index) :: lst, row, index + 1)
    } else if (lst(0).height == row(index)) {
      loop(lst, row, index + 1)
    } else {
      val r = pop(lst, row, index)
      if (r._1.isEmpty) {
        r._2
      }
      else {
        loop(r._1, row, index + 1)
      }
    }
  }

  val result = square.foldLeft(0L) { (acc, elm) =>
    scala.math.max(acc, loop(List.empty[Rect], elm, 0))
  }

  println(result)
}
