let solve ans w v =
  let rec duduwa ans j k = function
    | [] -> doit ans (j + 1, [(v.(j), k)])
    | (ch, cj) :: y' when ch >= v.(j) -> duduwa (if ch * (j - cj) > ans then ch * (j - cj) else ans) j cj y'
    | ys -> doit ans (j + 1, (v.(j), k) :: ys)
  and doit ans = function
    | (j, xs) when j = w -> List.fold_left (fun acc (ch, cj) -> if ch * (w - cj) > acc then ch * (w - cj) else acc) ans xs
    | (j, []) -> doit ans (j + 1, [(v.(j), j)])
    | (j, ((ch, _) :: _ as xs)) when ch = v.(j) -> doit ans (j + 1, xs)
    | (j, ((ch, _) :: _ as xs)) when ch < v.(j) -> doit ans (j + 1, (v.(j), j) :: xs)
    | (j, xs) -> duduwa ans j j xs in
  doit ans (0, [])

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let read () = List.map int_of_string (split_on_char ' ' (read_line ()))

let () =
  match read () with
  | [h; w] ->
    let v0 = Array.make w 0 in
    let v1 = Array.make w 0 in
    let rec doit i ans =
      if i = h then ans
      else
        let rec duduwa j = function
          | [] -> Array.iteri (fun i e -> v0.(i) <- e) v1; doit (i + 1) (solve ans w v1)
          | x::xs ->
            v1.(j) <- if x = 1 then 0 else v0.(j) + 1;
            duduwa (j + 1) xs in
        duduwa 0 (read ()) in
    Printf.printf "%d\n" (doit 0 0)
  | _ -> ()