#include "bits/stdc++.h"
using namespace std;
int main()
{
	int h, w, mx = 0;
	scanf("%d %d", &h, &w);
	vector<vector<int>> a(h, vector<int>(w));
	for(int i = 0; i < h; ++i)
	{
		for (int j = 0, k; j < w; ++j)
		{
			scanf("%d", &k);
			a[i][j] = !k;
		}
	}
	for(int i = 1; i < h; ++i)
	{
		for(int j = 0; j < w; ++j)
		{
			if(a[i][j])
			{
				a[i][j] += a[i - 1][j];
			}
		}
	}
	for(int i = 0; i < h; ++i)
	{
		stack<pair<int, int>> s;
		for(int j = 0, hor = 0; j < w; hor = ++j)
		{
			for(int t, u; !s.empty(); )
			{
				t = s.top().first;
				u = s.top().second;
				if(t >= a[i][j])
				{
					mx = max(mx, t * (j - u));
					hor = min(hor, u);
					s.pop();
				}
				else
				{
					break;
				}
			}
			s.push(make_pair(a[i][j], hor));
		}
		for(; !s.empty(); mx = max(mx, s.top().first * (w - s.top().second)), s.pop());
	}
	printf("%d\n", mx);
}

