#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <set>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
const int N = 1000;
string rows[N];
int maxUp[N][N];
int smallerToLeft[N];
int smallerToRight[N];
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; ++i)
cin >> rows[i];
for (int j = 0; j < m; ++j)
maxUp[0][j] = rows[0][j] - '0';
for (int i = 1; i < n; ++i)
for (int j = 0; j < m; ++j){
if (rows[i][j] == '0') maxUp[i][j] = 0;
else maxUp[i][j] = 1 + maxUp[i - 1][j];
}
int ans = 0;
for (int i = 0; i < n; ++i){
int* h = maxUp[i];
for (int j = 0; j < m; ++j){
smallerToLeft[j] = j - 1;
while (smallerToLeft[j] >= 0 && h[smallerToLeft[j]] >= h[j])
smallerToLeft[j] = smallerToLeft[smallerToLeft[j]];
}
for (int j = m - 1; j >= 0; --j)
{
smallerToRight[j] = j + 1;
while (smallerToRight[j] < m && h[smallerToRight[j]] >= h[j])
smallerToRight[j] = smallerToRight[smallerToRight[j]];
}
for (int j = 0; j < m; ++j)
{
int lb = smallerToLeft[j] + 1;
int rb = smallerToRight[j] - 1;
ans = max(ans, (rb - lb + 1) * h[j]);
}
}
cout << ans << endl;
return 0;
}