#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;

void ccp(vector<int>& c, int n, int m){
  sort(c.begin(), c.end());
  vector<vector<int> > t(m, vector<int>(n + 1));
  for(int i = 0; i < m; i++){
    t[i][0] = 0;
  }
  for(int j = 0; j <= n; j++){
    t[0][j] = j;
  }
  for(int i = 1; i < m; i++){
    for(int j = 0; j <= n; j++){
      if(j - c[i] < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = min(t[i - 1][j], t[i][j - c[i]] + 1);
    }
  }
  cout << t[m - 1][n] << endl;
  return;
}

void kp(vector<int>& v, vector<int>& w, int N, int W){
  vector<pair<int, int> > k(N);
  for(int i = 0; i < N; i++){
    k[i].second = v[i];
    k[i].first = w[i];
  }
  sort(k.begin(), k.end());
  vector<vector<int> > t(N, vector<int>(W + 1));
  for(int i = 0; i < N; i++){
    t[i][0] = 0;
  }
  for(int i = 0; i <= W; i++){
    if(i >= k[0].first) t[0][i] = k[0].second;
    else t[0][i] = 0;
  }
  for(int i = 1; i < N; i++){
    for(int j = 0; j <= W; j++){
      if(j - k[i].first < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = max(t[i - 1][j], t[i - 1][j - k[i].first] + k[i].second);
    }
  }
  cout << t[N - 1][W] << endl;
}

void lis(vector<int>& a){
  int n = a.size();
  vector<int> l(n);
  l[0] = a[0];
  int lid = 1;
  for(int i = 1; i < n; i++){
    int x = a[i];
    auto it = lower_bound(l.begin(), l.begin() + lid, x);
    int pos = (int)(it - l.begin());
    if(pos == lid){
      l[lid++] = x;
    }
    else *it = x;
    /*for(int i = 0; i < l.size(); i++){
      cout << l[i] << " ";
    }
    cout << endl;*/
  }
  cout << lid << endl;
}

void ls(vector<vector<int> >& c, vector<vector<int> > & dp, int h, int w){
  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(dp[i][j] != -1) continue;
      if(i >= 1) dp[i][j] = dp[i - 1][j];
      if(j >= 1) dp[i][j] = min(dp[i][j],dp[i][j - 1]);
      if(i >= 1 && j >= 1) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
      dp[i][j]++;
      dp[i][j] = min(dp[i][j], min(i, j) + 1);
      if(dp[i][j] == 0) dp[i][j] = 1;
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans * ans << endl;
}

void solve(){
  int h, w; cin >> h >> w;
  vector<vector<int> > c(h, vector<int>(w));
  vector<vector<int> > dp(h, vector<int>(w, 1));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> c[i][j];
      if(c[i][j] == 1) dp[i][j] = 0;
    }
  }
  for(int i = 1; i < h; i++){
    for(int j = 0; j < w; j++){
      if(dp[i][j] == 1) dp[i][j] = dp[i - 1][j] + 1;
    }
  }
  /*for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/
  int ans = 0;
  for(int i = 0; i < h; i++){
    stack<pair<int, int> > s;
    s.push(make_pair(dp[i][0], 0));
    for(int j = 1; j < w; j++){
      pair<int, int> x = s.top();
      if(x.first < dp[i][j]) s.push(make_pair(dp[i][j], j));
      else if(x.first > dp[i][j]){
        while(s.size() > 0 && s.top().first >= dp[i][j]){
          //cout << s.top().first << " " << s.top().second << " -> ";
          ans = max(ans, s.top().first * (j - s.top().second));
          x = s.top();
          s.pop();
        }
        s.push(make_pair(dp[i][j], x.second));
      }
    }
    //cout << endl;
    while(s.size() > 0){
      //cout << s.top().first << " " << s.top().second << " -> ";
      ans = max(ans, s.top().first * (w - s.top().second));
      s.pop();
    }
    //cout << ans << endl << endl;
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}



Measured memory_bytes: 18128