using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private struct Rect
        {
            public int h;
            public int pos;
            public Rect(int h, int pos)
            {
                this.h = h;
                this.pos = pos;
            }
        }
        private static void SolveA(string[] args)
        {
            int[] hw = ReadAndParseIntArr();
            int h = hw[0];
            int w = hw[1];
            int[,] c = new int[h, w];
            for(int i=0;i<h;++i)
            {
                int[] tmpc = ReadAndParseIntArr();
                for(int j=0;j<tmpc.Length;++j)
                {
                    c[i, j] = tmpc[j];
                }
            }

            // 事前計算
            int[,] g = new int[h, w];
            for(int i=0;i<h;++i)
            {
                for(int j =0;j<w;++j)
                {
                    if( c[i,j]  == 0)
                    {
                        if (i == 0)
                        {
                            g[i, j] = 1;
                        }
                        else
                        {
                            g[i, j] = g[i - 1, j] + 1;
                        }
                    }
                    else
                    {
                        g[i, j] = 0;
                    }
                }
            }

            var stack = new Stack<Rect>();

            var histgram = new List<int>();

            int maxS = 0;
            for(int i=0;i<h;++i)
            {
                //int left = -1;
                int right = 0;

                while (true)
                {
                    // ヒストグラム求める
                    histgram.Clear();

                    while (right < w && g[i, right] >= 1)
                    {
                        histgram.Add(g[i, right]);
                        right++;

                    }
                    // right見つかった histgramに値格納されてるぜ
                    histgram.Add(0);
                    maxS = Math.Max(maxS, CalcMaxRect(stack, histgram));
                    if( right < w)
                    {
                        right++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(maxS);
        }

        private static int CalcMaxRect(Stack<Rect> stack, List<int> histgram)
        {
            if( histgram.Count == 0) { return 0; }
            if(histgram.Count == 1) { return histgram[0]; }
            int maxS = histgram.Max();
            stack.Clear();
            for (int i = 0; i < histgram.Count; ++i)
            {
                var rect = new Rect(histgram[i], i);

                if (stack.Count == 0)
                {
                    stack.Push(rect);
                }
                else if (stack.Peek().h < rect.h)
                {
                    stack.Push(rect);
                }
                else if (stack.Peek().h == rect.h)
                {
                    // 何もしない
                }
                else
                {
                    Rect lastPopRect = stack.Peek();
                    while (stack.Count >= 1 && stack.Peek().h >= rect.h)
                    {
                        lastPopRect = stack.Pop();
                        int s = lastPopRect.h * (rect.pos - lastPopRect.pos);
                        maxS = Math.Max(maxS, s);
                    }
                    rect.pos = lastPopRect.pos;
                    stack.Push(rect);
                }
            }
            return maxS;
        }
        
    }
}



Measured memory_bytes: 53284