//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
char f[5005][5005];
int v[5005];
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
	{
			scanf("%s",&f[i]);
			for(int j=0;j<m;j++)
			{
					if(f[i][j]=='1') v[i]++;
			}
	}
	int ret=0;
	for(int i=0;i<n;i++)
	{
			int least=INF;
			for(int j=i;j<n&&least;j++)
			{
					least=min(least,v[j]);
					ret=max(ret,least*(j-i+1));
			}
	}
	printf("%d\n",ret);
}


//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
char f[5005];
vector<int>rightt[5005];
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
	{
			scanf("%s",f);
			int le;
			bool len=false;
			for(int j=0;j<m;j++)
			{
					if(!len && f[j]=='1')
					{
						len=true;
						le=j;
					}
					if(len && f[j]=='0')
					{
							len=false;
							rightt[le].pb(j-1);
					}
			}
			if(len)
			{
					rightt[le].pb(m-1);
			}
	}
	vector<int>s;
	int ret=0;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<rightt[i].size();j++) s.pb(rightt[i][j]);
		sort(s.begin(),s.end(),greater<int>());
		int ss=s.size()-1;
		for(int j=ss;j>=0;j--) if(s[j]<i) s.pop_back();
		int cur=0;
		int pointt=0;
		while(cur<s.size())
		{
			while(pointt<s.size() && s[cur]==s[pointt]) pointt++;
			ret=max(ret,(pointt)*(s[cur]-i+1));

			//printf("%d %d\n",(pointt-cur),(rightt[i][cur]-i+1));
			cur=pointt;
		}
	}
	printf("%d\n",ret);
	cin >> ret;

}


//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
char f[5005];
vector<int>rightt[5005];
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
	{
			scanf("%s",f);
			int le;
			bool len=false;
			for(int j=0;j<m;j++)
			{
					if(!len && f[j]=='1')
					{
						len=true;
						le=j;
					}
					if(len && f[j]=='0')
					{
							len=false;
							rightt[le].pb(j-1);
					}
			}
			if(len)
			{
					rightt[le].pb(m-1);
			}
	}
	int ret=0;
	for(int i=0;i<m;i++)
	{
		sort(rightt[i].begin(),rightt[i].end(),greater<int>());
		int cur=0;
		int pointt=0;
		while(cur<rightt[i].size())
		{
			while(pointt<rightt[i].size() && rightt[i][cur]==rightt[i][pointt]) pointt++;
			ret=max(ret,(pointt)*(rightt[i][cur]-i+1));

			//printf("%d %d\n",(pointt-cur),(rightt[i][cur]-i+1));
			cur=pointt;
		}
	}
	printf("%d\n",ret);
	cin >> ret;

}


/****** BISMILLAHIR RAHMANIR RAHIM ******/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int ul;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef map<string,string> mss;
typedef map<int, vector<int> > mvii;
typedef map<int, int> mii;
typedef queue <int> qi;
typedef map <int, vector<string> > mvis;
typedef map <string, vector<int> > mvsi;
typedef vector <string> vs;
typedef pair <int, int> pii;

#define MP make_pair
#define SORT(a) sort (a.begin(), a.end())
#define REVERSE(a) reverse (a.begin(), a.end())
#define PI acos(-1)
#define ms(x,y) memset (x, y, sizeof (x))
#define INF 2000000000
#define pb push_back
#define MAX 100002
#define debug cout<<"A"<<endl
#define prnt(a) cout<<a<<endl
#define mod 1000000009
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORr(i,a,b) for (int i=(a); i>=b; i--)
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

/* Direction Array */

// int fx[]={1,-1,0,0};
// int fy[]={0,0,1,-1};
// int fx[]={0,0,1,-1,-1,1,-1,1};
// int fy[]={-1,1,0,0,1,1,-1,-1};

template <class T> inline T bigmod(T p,T e,T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

inline ll power(ll a, ll b)
{
	ll multiply=1;
	FOR(i,0,b)
	{
		multiply*=a;
	}
	return multiply;
}

/****** END OF HEADER ******/

char a[5002][5002];
int ones[5002][5002];

int main()
{
	ios_base::sync_with_stdio(0);
	// freopen("in.txt","r",stdin);
	int n, m;

	scanf("%d%d", &n,&m);

	getchar();

	FOR(i,1,n+1)
	{
		scanf("%s", a[i]+1);
		getchar();
	}

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
		{
			if(a[i][j]=='1') ones[i][j]=ones[i][j-1]+1;
			else ones[i][j]=0;
 		}
	}
	int ans=0;
	FORr(i,m,1)
	{
		vi v;

		FOR(j,1,n+1)
		{
			v.pb(ones[j][i]);
		}

		SORT(v);
		REVERSE(v);

		FOR(j,0,v.size())
		{
			ans=max(ans,v[j]*(j+1));
		}
	}

	prnt(ans);

	return 0;
}


#define ll long long
#define vi vector <int>
#define pii pair <int,int>
#define FOR(i, a, b) for (i = (a); i <= (b); i++)
#define REP(i, a) for (i = 0; i < (a); i++)
#define ALL(v) (v).begin(), (v).end()
#define SET(a, x) memset((a), (x), sizeof(a))
#define SZ(a) ((int)(a).size())
#define CL(a) ((a).clear())
#define SORT(x) sort(ALL(x))
#define mp make_pair
#define pb push_back
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

#define filer() freopen("in.txt","r",stdin)
#define filew() freopen("out.txt","w",stdout)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <queue>
#include <cassert>

using namespace std;

char g[5555][5555];
int sum[5555][5555];

int main()
{

    int i,j,k,n,m;

    cin>>n>>m;

    for(i=1;i<=n;i++)scanf("%s",g[i]+1);

    for( i=1;i<=n;i++ )
    {
        for( j=1;j<=m;j++ )
        {
            if( g[i][j]=='0' )sum[i][j]=0;
            else sum[i][j]=sum[i][j-1]+1;
        }

       // cout<<sum[i][1]<<endl;

    }

    int ans=0;

    for( i=m;i>=1;i-- )//col
    {

        vi v;

        for( j=1;j<=n;j++ )//row
        {
            v.pb( sum[j][i] );
        //    cout<<j<<" "<<i<<" "<<sum[j][i]<<endl;

        }

        SORT(v);
        reverse(ALL(v));

        for( j=0;j<v.size();j++ )
        {
            //cout<<v[j]<<" ";
            ans=max( ans,v[j]*(j+1) );
        }//cout<<endl;

    }
    cout<<ans<<endl;

}


/****** BISMILLAHIR RAHMANIR RAHIM ******/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int ul;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef map<string,string> mss;
typedef map<int, vector<int> > mvii;
typedef map<int, int> mii;
typedef queue <int> qi;
typedef map <int, vector<string> > mvis;
typedef map <string, vector<int> > mvsi;
typedef vector <string> vs;
typedef pair <int, int> pii;

#define MP make_pair
#define SORT(a) sort (a.begin(), a.end())
#define REVERSE(a) reverse (a.begin(), a.end())
#define PI acos(-1)
#define ms(x,y) memset (x, y, sizeof (x))
#define INF 2000000000
#define pb push_back
#define MAX 100002
#define debug cout<<"A"<<endl
#define prnt(a) cout<<a<<endl
#define mod 1000000009
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORr(i,a,b) for (int i=(a); i>=b; i--)
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

/* Direction Array */

// int fx[]={1,-1,0,0};
// int fy[]={0,0,1,-1};
// int fx[]={0,0,1,-1,-1,1,-1,1};
// int fy[]={-1,1,0,0,1,1,-1,-1};

template <class T> inline T bigmod(T p,T e,T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

inline ll power(ll a, ll b)
{
	ll multiply=1;
	FOR(i,0,b)
	{
		multiply*=a;
	}
	return multiply;
}

/****** END OF HEADER ******/

char a[5002][5002];
int ones[5002][5002];

int main()
{
	ios_base::sync_with_stdio(0);
	// freopen("in.txt","r",stdin);
	int n, m;
	cin>>n>>m;

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
			cin>>a[i][j];
	}

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
		{
			if(a[i][j]=='1') ones[i][j]=ones[i][j-1]+1;
			else ones[i][j]=0;
 		}
	}
	int ans=0;
	FORr(i,m,1)
	{
		vi v;

		FOR(j,1,n+1)
		{
			v.pb(ones[j][i]);
		}

		SORT(v);
		REVERSE(v);

		FOR(j,0,v.size())
		{
			ans=max(ans,v[j]*(j+1));
		}
	}

	prnt(ans);

	return 0;
}


/****** BISMILLAHIR RAHMANIR RAHIM ******/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int ul;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef map<string,string> mss;
typedef map<int, vector<int> > mvii;
typedef map<int, int> mii;
typedef queue <int> qi;
typedef map <int, vector<string> > mvis;
typedef map <string, vector<int> > mvsi;
typedef vector <string> vs;
typedef pair <int, int> pii;

#define MP make_pair
#define SORT(a) sort (a.begin(), a.end())
#define REVERSE(a) reverse (a.begin(), a.end())
#define PI acos(-1)
#define ms(x,y) memset (x, y, sizeof (x))
#define INF 2000000000
#define pb push_back
#define MAX 100002
#define debug cout<<"A"<<endl
#define prnt(a) cout<<a<<endl
#define mod 1000000009
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORr(i,a,b) for (int i=(a); i>=b; i--)
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

/* Direction Array */

// int fx[]={1,-1,0,0};
// int fy[]={0,0,1,-1};
// int fx[]={0,0,1,-1,-1,1,-1,1};
// int fy[]={-1,1,0,0,1,1,-1,-1};

template <class T> inline T bigmod(T p,T e,T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

inline ll power(ll a, ll b)
{
	ll multiply=1;
	FOR(i,0,b)
	{
		multiply*=a;
	}
	return multiply;
}

/****** END OF HEADER ******/

char a[5002][5002];
int ones[5002][5002];

int main()
{
	ios_base::sync_with_stdio(0);
	// freopen("in.txt","r",stdin);
	int n, m;

	scanf("%d%d", &n,&m);

	getchar();

	FOR(i,1,n+1)
	{
		scanf("%s", a[i]+1);
		getchar();
	}

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
		{
			if(a[i][j]=='1') ones[i][j]=ones[i][j-1]+1;
			else ones[i][j]=0;
 		}
	}
	int ans=0;
	FORr(i,m,1)
	{
		vi v;

		FOR(j,1,n+1)
		{
			v.pb(ones[j][i]);
		}

		sort(v.begin(),v.end(),greater<int>());

		FOR(j,0,v.size())
		{
			ans=max(ans,v[j]*(j+1));
		}
	}

	prnt(ans);

	return 0;
}


/****** BISMILLAHIR RAHMANIR RAHIM ******/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int ul;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef map<string,string> mss;
typedef map<int, vector<int> > mvii;
typedef map<int, int> mii;
typedef queue <int> qi;
typedef map <int, vector<string> > mvis;
typedef map <string, vector<int> > mvsi;
typedef vector <string> vs;
typedef pair <int, int> pii;

#define MP make_pair
#define SORT(a) sort (a.begin(), a.end())
#define REVERSE(a) reverse (a.begin(), a.end())
#define PI acos(-1)
#define ms(x,y) memset (x, y, sizeof (x))
#define INF 2000000000
#define pb push_back
#define MAX 100002
#define debug cout<<"A"<<endl
#define prnt(a) cout<<a<<endl
#define mod 1000000009
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORr(i,a,b) for (int i=(a); i>=b; i--)
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

/* Direction Array */

// int fx[]={1,-1,0,0};
// int fy[]={0,0,1,-1};
// int fx[]={0,0,1,-1,-1,1,-1,1};
// int fy[]={-1,1,0,0,1,1,-1,-1};

template <class T> inline T bigmod(T p,T e,T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

inline ll power(ll a, ll b)
{
	ll multiply=1;
	FOR(i,0,b)
	{
		multiply*=a;
	}
	return multiply;
}

/****** END OF HEADER ******/

char a[5002][5002];
int ones[5002][5002];

int main()
{
	ios_base::sync_with_stdio(0);
	// freopen("in.txt","r",stdin);
	int n, m;
	cin>>n>>m;

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
			cin>>a[i][j];
	}

	FOR(i,1,n+1)
	{
		FOR(j,1,m+1)
		{
			if(a[i][j]=='1') ones[i][j]=ones[i][j-1]+1;
			else ones[i][j]=0;
 		}
	}
	int ans=0;
	FORr(i,m,1)
	{
		vi v;

		FOR(j,1,n+1)
		{
			v.pb(ones[j][i]);
		}

		sort(v.begin(),v.end(),greater<int>());

		FOR(j,0,v.size())
		{
			ans=max(ans,v[j]*(j+1));
		}
	}

	prnt(ans);

	return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,j;
char f[5005][5005];
int r[5005][5005],d[5005];
bool cmp(int a,int b)
{
    return r[a][j]>r[b][j];
}
int main()
{
    int i,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(i=0;i<n;i++)
                d[i]=i;
        for(j=0;j<m;j++)
        {
            sort(d,d+n,cmp);
            for(i=0;i<n;i++)
            {
                ma=max(ma,(i+1)*r[d[i]][j]);
            }

        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<m;j++)
        {
            memset(d,0,sizeof d);
            for(i=0;i<n;i++)
                d[r[i][j]]++;
            int cnt=0;
            for(i=n;i>=0;i--)
            {
                cnt+=d[i];
                ma=max(ma,cnt*i);
            }
        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<m;j++)
        {
            memset(d,0,sizeof d);
            for(i=0;i<n;i++)
                d[r[i][j]]++;
            int cnt=0;
            for(i=m;i>=0;i--)
            {
                cnt+=d[i];
                ma=max(ma,cnt*i);
            }
        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<m;j++)
        {
            memset(d,0,sizeof d);
            for(i=0;i<n;i++)
                d[r[i][j]]++;
            int cnt=0;
            for(i=5000;i>=0;i--)
            {
                if(d[i])
                {
                    cnt+=d[i];
                    ma=max(ma,cnt*i);
                }
            }
        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<n;j++)
        {
            for(i=0;i<n;i++)
                d[i]=r[i][j];
            sort(d,d+n);
            for(i=n-1;i>=0;i--)
            {
                ma=max(ma,(n-i)*d[i]);
            }

        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<m;j++)
        {
            memset(d,0,sizeof d);
            for(i=0;i<n;i++)
                d[r[i][j]]++;
            int cnt=0;
            for(i=5000;i>=0;i--)
            {
                cnt+=d[i];
                ma=max(ma,cnt*i);
            }
        }
        printf("%d\n",ma);
    }
    return 0;
}


#include <cstdio>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char f[5005][5005];
int r[5005][5005],d[5005];
int main()
{
    int i,j,k;
    while(~scanf("%d%d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%s",f[i]);
        memset(r,0,sizeof r);
        for(i=0;i<n;i++)
        {
            for(j=m-1;j>=0;j--)
            {
                if(f[i][j]=='1')
                    if(j==m-1)
                        r[i][j]=1;
                    else
                        r[i][j]=r[i][j+1]+1;
            }
        }
        int ma=0;
        for(j=0;j<m;j++)
        {
            for(i=0;i<n;i++)
                d[i]=r[i][j];
            sort(d,d+n);
            for(i=n-1;i>=0;i--)
            {
                ma=max(ma,(n-i)*d[i]);
            }

        }
        printf("%d\n",ma);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
char A[MAXN][MAXN];
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            scanf( "%s", A[i] );

    for(int i=1;i<=N;i++)
            for(int j=0;j<M;j++){
                    if( j == 0 )
                        table[i][j+1] = A[i][j] - '0';
                    else if( A[i][j] == '1' )
                         table[i][j+1] = 1 + table[i][j];
                         }

    int best = 0;
    for(int j=1;j<=M;j++){
            int meg = 0;

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++){
                    row[ table[i][j] ]++;
                    if( table[i][j] > meg )
                        meg = table[i][j];
                        }

            int sum = 0;
            for(int i=meg;i>=1;i--){
                    sum += row[i];
                    if( i * sum > best )
                        best = i * sum;
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
char A[MAXN][MAXN];
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            scanf( "%s", A[i] );

    for(int i=1;i<=N;i++)
            for(int j=0;j<M;j++){
                    if( j == 0 )
                        table[i][j+1] = A[i][j] - '0';
                    else if( A[i][j] == 1 )
                         table[i][j+1] = 1 + table[i][j];
                         }

    int best = 0;
    for(int j=1;j<=M;j++){
            int meg = 0;

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++){
                    row[ table[i][j] ]++;
                    if( table[i][j] > meg )
                        meg = table[i][j];
                        }

            int sum = 0;
            for(int i=meg;i>=1;i--){
                    sum += row[i];
                    if( i * sum > best )
                        best = i * sum;
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            for(int j=1;j<=M;j++){
                    char a; do{ scanf( "%c", &a ); }while( (a != '0') && (a != '1') );
                    if( a == '0' )
                        table[i][j] = 0;
                    else
                        table[i][j] = table[i][j-1] + 1;
                    }

    int best = 0;
    for(int j=1;j<=M;j++){
            int meg = 0;
            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++){
                    row[ table[i][j] ]++;
                    if( table[i][j] > meg )
                        meg = table[i][j];
                        }

            int sum = 0;
            for(int i=meg;i>=1;i--){
                    sum += row[i];
                    best = max( best, i * sum );
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            for(int j=1;j<=M;j++){
                    char a; do{ scanf( "%c", &a ); }while( (a != '0') && (a != '1') );
                    if( a == '0' )
                        table[i][j] = 0;
                    else
                        table[i][j] = table[i][j-1] + 1;
                    }

    int best = 0;
    for(int j=1;j<=M;j++){

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++)
                    row[ table[i][j] ]++;

            int sum = 0;
            for(int i=N;i>=1;i--){
                    sum += row[i];
                    best = max( best, i * sum );
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            for(int j=1;j<=M;j++){
                    char a; do{ scanf( "%c", &a ); }while( (a != '0') && (a != '1') );
                    if( a == '0' )
                        table[i][j] = 0;
                    else
                        table[i][j] = table[i][j-1] + 1;
                    }

    int best = 0;
    for(int j=1;j<=M;j++){

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++)
                    row[ table[i][j] ]++;

            int sum = 0;
            for(int i=5000;i>=1;i--){
                    sum += row[i];
                    best = max( best, i * sum );
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++){
            for(int j=1;j<=M;j++){
                    char a; scanf( "%c", &a );
                    if( a == '0' )
                        table[i][j] = 0;
                    else
                        table[i][j] = table[i][j-1] + 1;
                    }
            char a; scanf( "%c", &a );
            }

    int best = 0;
    for(int j=1;j<=M;j++){
            int meg = 0;

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++){
                    row[ table[i][j] ]++;
                    if( table[i][j] > meg )
                        meg = table[i][j];
                        }

            int sum = 0;
            for(int i=meg;i>=1;i--){
                    sum += row[i];
                    if( i * sum > best )
                        best = i * sum;
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

const int MAXN = 5010;

using namespace std;

int N,M;
int table[MAXN][MAXN];
int row[MAXN];

int main(){

    scanf( "%d %d", &N, &M );
    for(int i=1;i<=N;i++)
            for(int j=1;j<=M;j++){
                    char a; scanf( "%c", &a );
                    if( a == '0' )
                        table[i][j] = 0;
                    else
                        table[i][j] = table[i][j-1] + 1;
                    }

    int best = 0;
    for(int j=1;j<=M;j++){
            int meg = 0;

            memset( row, 0, sizeof row );
            for(int i=1;i<=N;i++){
                    row[ table[i][j] ]++;
                    if( table[i][j] > meg )
                        meg = table[i][j];
                        }

            int sum = 0;
            for(int i=meg;i>=1;i--){
                    sum += row[i];
                    if( i * sum > best )
                        best = i * sum;
                    }

            }

    printf( "%d\n", best );

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <string>

using namespace std;

long n,m,i,j,l[5005][5005],rad[5005],k,h,ans,p;
string s;

int main()
{
	cin >> n >> m;
	getline(cin,s);
	for (i=1;i<=n;i++)
	{
		getline(cin,s);
		for (j=1;j<=m;j++)
			if (s[j-1]=='0') l[i][j]=0;
			else l[i][j]=l[i][j-1]+1;
	}
	ans=0;
	for (j=1;j<=m;j++){
		for (i=1;i<=m;i++) rad[i]=0;
		for (i=1;i<=n;i++) rad[l[i][j]]++;
		h=0;
		for (i=m;i>=1;i--)
			if (rad[i]>0)
			for (k=1;k<=rad[i];k++){
				h++;
				p=i*h;
				if (ans<p) ans = p;
			}
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

long n,m,i,j,l[5005][5005],rad[5005],k,h,ans,p;
char s[5005];

int main()
{
	cin >> n >> m;
	for (i=1;i<=n;i++)
	{
		cin >> s;
		for (j=1;j<=m;j++)
			if (s[j-1]=='0') l[i][j]=0;
			else l[i][j]=l[i][j-1]+1;
	}
	ans=0;
	for (j=1;j<=m;j++){
		for (i=1;i<=m;i++) rad[i]=0;
		for (i=1;i<=n;i++) rad[l[i][j]]++;
		h=0;
		for (i=m;i>=1;i--)
			if (rad[i]>0)
			for (k=1;k<=rad[i];k++){
				h++;
				p=i*h;
				if (ans<p) ans = p;
			}
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

long n,m,i,j,l[5005][5005],rad[5005],k,h,ans,p;
char s[5005];

int main()
{
	cin >> n >> m;
	for (i=1;i<=n;i++)
	{
		scanf("%s",&s);
		for (j=1;j<=m;j++)
			if (s[j-1]=='0') l[i][j]=0;
			else l[i][j]=l[i][j-1]+1;
	}
	ans=0;
	for (j=1;j<=m;j++){
		for (i=1;i<=m;i++) rad[i]=0;
		for (i=1;i<=n;i++) rad[l[i][j]]++;
		h=0;
		for (i=m;i>=1;i--)
			if (rad[i]>0)
			for (k=1;k<=rad[i];k++){
				h++;
				p=i*h;
				if (ans<p) ans = p;
			}
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int sum[maxn];
char s[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(s[i]+1);
    }

    for (int j=1; j<=m; ++j)
    {
        memset (sum,0,sizeof(sum));

        for (int i=1; i<=n; ++i)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];

            sum[cnt[i][j]] ++;
        }

        for (int i=1; i<=m; ++i)
        {
            best = max (best, sum[i]*i);
        }
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int arb[maxn*4],lazy[maxn*4];
char s[maxn][maxn];
char rev[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

void update (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (l <= left && right <= r)
    {
        arb[node] ++;
        if (left != right)
        {
            lazy[node*2] ++;
            lazy[node*2+1]++;
        }
        return;
    }

    int mid = (left+right)/2;

    if (l <= mid) update (node*2,left,mid);
    if (r > mid) update (node*2+1,mid+1,right);

    arb[node] = max (arb[node*2],arb[node*2+1]);
}

void query (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (left==right)
    {
        maxv = max (maxv,left*arb[node]);
        return;
    }

    int mid = (left+right)/2;

    query (node*2,left,mid);
    query (node*2+1,mid+1,right);
}

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(rev[i]+1);
    }

    for (int i=1; i<=m; ++i)
        for (int j=1; j<=n; ++j)
    {
        s[i][j] = rev[j][i];
    }

    for (int i=1; i<=m; ++i)
    {
        memset (arb,0,sizeof(arb));
        memset(lazy,0,sizeof(lazy));

        for (int j=1; j<=n; ++j)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i-1][j]+1;

            l = 1;  r = cnt[i][j];

            if (r!=0) update (1,1,m);
        }

        maxv = 0;

        query (1,1,m);

        best = max (best,maxv);
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int sum[maxn];
char s[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(s[i]+1);
    }

    for (int j=1; j<=m; ++j)
    {
        memset (sum,0,sizeof(sum));

        int maxv = 0;

        for (int i=1; i<=n; ++i)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];
            maxv = max (maxv,cnt[i][j]);

            sum[cnt[i][j]] ++;
        }

        int c = 0;

        for (int i=maxv; i>=1; --i)
        {
            c += sum[i];
            best = max (best, c*i);
        }
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int arb[maxn*4],lazy[maxn*4];
char s[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

void update (int node, int left, int right)
{
    if (l <= left && right <= r)
    {
        arb[node] ++;
        if (left != right)
        {
            lazy[node*2] ++;
            lazy[node*2+1]++;
        }
        return;
    }

    int mid = (left+right)/2;

    if (l <= mid) update (node*2,left,mid);
    if (r > mid) update (node*2+1,mid+1,right);

    arb[node] = max (arb[node*2],arb[node*2+1]);
}

void query (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (left==right)
    {
        maxv = max (maxv,left*arb[node]);
        return;
    }

    int mid = (left+right)/2;

    query (node*2,left,mid);
    query (node*2+1,mid+1,right);
}

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(s[i]+1);
    }

    for (int j=1; j<=m; ++j)
    {
        memset (arb,0,sizeof(arb));
        memset(lazy,0,sizeof(lazy));

        for (int i=1; i<=n; ++i)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];

            if (r!=0) update (1,1,n);
        }

        maxv = 0;

        query (1,1,n);

        best = max (best,maxv);
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int arb[maxn*4],lazy[maxn*4];
char s[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

void update (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (l <= left && right <= r)
    {
        arb[node] ++;
        if (left != right)
        {
            lazy[node*2] ++;
            lazy[node*2+1]++;
        }
        return;
    }

    int mid = (left+right)/2;

    if (l <= mid) update (node*2,left,mid);
    if (r > mid) update (node*2+1,mid+1,right);

    arb[node] = max (arb[node*2],arb[node*2+1]);
}

void query (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (left==right)
    {
        maxv = max (maxv,left*arb[node]);
        return;
    }

    int mid = (left+right)/2;

    query (node*2,left,mid);
    query (node*2+1,mid+1,right);
}

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(s[i]+1);
    }

    for (int j=1; j<=m; ++j)
    {
        memset (arb,0,sizeof(arb));
        memset(lazy,0,sizeof(lazy));

        for (int i=1; i<=n; ++i)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];

            if (r!=0) update (1,1,m);
        }

        maxv = 0;

        query (1,1,m);

        best = max (best,maxv);
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int sum[maxn];
char s[maxn][maxn];
char rev[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv;

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(rev[i]+1);
    }

    for (int i=1; i<=m; ++i)
        for (int j=1; j<=n; ++j)
    {
        s[i][j] = rev[j][i];
    }

    for (int i=1; i<=m; ++i)
    {
        memset (sum,0,sizeof(sum));

        int maxv = 0;

        for (int j=1; j<=n; ++j)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i-1][j]+1;

            maxv = max (maxv,cnt[i][j]);

            sum[cnt[i][j]] ++;
        }

        int c = 0;

        for (int j=maxv; j>=1; --j)
        {
            c += sum[j];
            best = max (best, c*j);
        }
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int arb[maxn*4],lazy[maxn*4];
char s[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

void update (int node, int left, int right)
{
    if (l <= left && right <= r)
    {
        arb[node] ++;
        if (left != right)
        {
            lazy[node*2] ++;
            lazy[node*2+1]++;
        }
        return;
    }

    int mid = (left+right)/2;

    if (l <= mid) update (node*2,left,mid);
    if (r > mid) update (node*2+1,mid+1,right);

    arb[node] = max (arb[node*2],arb[node*2+1]);
}

void query (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
    }

    if (left==right)
    {
        maxv = max (maxv,left*arb[node]);
        return;
    }

    int mid = (left+right)/2;

    query (node*2,left,mid);
    query (node*2+1,mid+1,right);
}

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(s[i]+1);
    }

    for (int j=1; j<=m; ++j)
    {
        memset (arb,0,sizeof(arb));
        memset(lazy,0,sizeof(lazy));

        for (int i=1; i<=n; ++i)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];

            if (r!=0) update (1,1,n);
        }

        maxv = 0;

        query (1,1,n);

        best = max (best,maxv);
    }

    cout<<best;
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>

#define vint vector<int>::iterator
#define vintp vector<pair<int,int> >::iterator
#define inf 1000000000
#define ll long long
#define maxn 5010
#define mod 1000000009
using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

int n,m,a,b,c;

int arb[maxn*4],lazy[maxn*4];
char s[maxn][maxn];
char rev[maxn][maxn];
int cnt[maxn][maxn];
int best,maxv,l,r;

void update (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (l <= left && right <= r)
    {
        arb[node] ++;
        if (left != right)
        {
            lazy[node*2] ++;
            lazy[node*2+1]++;
        }
        return;
    }

    int mid = (left+right)/2;

    if (l <= mid) update (node*2,left,mid);
    if (r > mid) update (node*2+1,mid+1,right);

    arb[node] = max (arb[node*2],arb[node*2+1]);
}

void query (int node, int left, int right)
{
    if (lazy[node])
    {
        arb[node] += lazy[node];
        if (left != right)
        {
            lazy[node*2] +=lazy[node];
            lazy[node*2+1]+=lazy[node];
        }
        lazy[node] = 0;
    }

    if (left==right)
    {
        maxv = max (maxv,left*arb[node]);
        return;
    }

    int mid = (left+right)/2;

    query (node*2,left,mid);
    query (node*2+1,mid+1,right);
}

int main ()
{
    cin>>n>>m;

    for (int i=1; i<=n; ++i)
    {
        cin>>(rev[i]+1);
    }

    for (int i=1; i<=m; ++i)
        for (int j=1; j<=n; ++j)
    {
        s[i][j] = rev[j][i];
    }

    for (int i=1; i<=m; ++i)
    {
        memset (arb,0,sizeof(arb));
        memset(lazy,0,sizeof(lazy));

        for (int j=1; j<=n; ++j)
        {
            if (s[i][j]-'0' == 0)
                cnt[i][j] = 0;
            else cnt[i][j] = cnt[i][j-1]+1;

            l = 1;  r = cnt[i][j];

            if (r!=0) update (1,1,m);
        }

        maxv = 0;

        query (1,1,m);

        best = max (best,maxv);
    }

    cout<<best;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = 5000; i >= 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = 5000; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
            ans = max(ans, cum[i]*i);
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    register int n,m,ans =0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = m-1; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            register int p = cum[i]*i;
            if (p > ans) ans = p;
        }
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

char M[5005][5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) cin >> M[i];
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = 5000; i >= 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = 5000; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
            ans = max(ans, cum[i]*i);
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

LL gcd(LL a, LL b) {
    if (b == 0)
	return a;
    return gcd(b, a%b);
}

// Round 221 CF

vector <string> M(5005);
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    int n = GI;
    int m = GI;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j >= m-2; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = 5000; i >= 0; i--) {
            if (i != 5000)
                cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') {
                R[i][j] = R[i][j+1] + 1;
            }
            else {
                R[i][j] = 0;
            }
            cum[R[i][j]]++;
        }
        for (int i = 5000; i >= 0; i--) {
            if (i != 5000)
                cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    int n;
    int m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> M[i];
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = n; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = n; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n,m,ans=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = m-1; j >= 0; j--) {
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            cum[i+1] = 0;
            int p = cum[i]*i;
            if (p > ans) ans = p;
        }
        cum[1] = 0;
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
            cum[i+2] = 0;
        }
        cum[0] = 0;
        cum[1] = 0;
        cum[2] = 0;
    }
    for (int j = m-2; j >= 0; j--) {
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
            cum[i+2] = 0;
        }
        cum[0] = 0;
        cum[1] = 0;
        cum[2] = 0;
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    int n;
    int m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> M[i];
    }
    int ans = 0;
    for (int j = m-1; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> M[i];
    }
    int ans = 0;
    for (int j = m-1; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    register int n,m,ans =0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = m-1; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    register int n,m,ans =0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    int cum[5003];
    for (int j = m-1; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            register int p = cum[i]*i;
            if (p > ans) ans = p;
        }
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n,m,ans=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = m-1; j >= 0; j--) {
        for (int i = 0; i < n; i++) {
            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            cum[i+1] = 0;
            int p = cum[i]*i;
            if (p > ans) ans = p;
        }
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n,m,ans=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = 1; j <= m; j++) {
        memset(cum, 0, sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j-1] == '1') R[i][j] = R[i][j-1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            int p = cum[i]*i;
            if (p > ans) ans = p;
        }
        cum[1] = 0;
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <sstream>
# include <algorithm>
# include <numeric>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <vector>
# include <list>
# include <set>
# include <map>
# include <iomanip>
# include <stack>
# include <queue>
# include <cctype>
# include <climits>
# include <assert.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int, PII> TIII;
typedef vector<PII> VPII;
typedef vector<double> VD;
typedef pair<double,double> PDD;

const int inf=1000000000;
const LL INF=LL(inf)*inf;
const double eps=1e-9;
const double PI=2*acos(0.0);

#define GI ({int t;scanf("%d",&t);t;})
#define REP(i,a,b) for(int i=a;i<b;i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define TR(i,x) for(typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define bit(n) (1<<(n))
#define bit64(n) ((LL(1))<<(n))
#define PB push_back
#define SZ size()
#define MP make_pair
#define CL clear()
#define fill(ar,val) memset((ar),(val), sizeof(ar))
#define MIN(a,b) {if((a)>(b)) (b);}
#define MAX(a,b) {if((a)<(b)) (b);}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define sqr(x) ((x)*(x))
#define X first
#define Y second

//clock_t start=clock();
//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

// Round 221 CF

string M[5005];
int R[5005][5005];
int cum[5005];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n;
    int m;
    cin >> n >> m;
    REP(i,0,n) {
        string a;
        cin >> a;
        M[i] = a;
    }
    int ans = 0;
    for (int j = m-1; j > m-2; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            R[i][j] = M[i][j] == '1';
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            ans = max(ans, cum[i]*i);
        }
    }
    for (int j = m-2; j >= 0; j--) {
        memset(cum,0,4 * (m+2));
        for (int i = 0; i < n; i++) {
            R[i][j] = (M[i][j] == '1')?1 + R[i][j+1]:0;
//            if (M[i][j] == '1') R[i][j] = R[i][j+1] + 1;
//            else R[i][j] = 0;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            if (cum[i] * i > ans) ans = cum[i]*i;
        }
    }
    cout << ans << endl;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

string M[5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n,m,ans=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = 1; j <= m; j++) {
        memset(cum, 0, sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j-1] == '1') R[i][j] = R[i][j-1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            int p = cum[i]*i;
            if (p > ans) ans = p;
        }
    }
    cout << ans;
    return 0;
}


# include <iostream>
# include <fstream>
# include <numeric>
# include <cstring>
# include <cmath>
# include <set>
# include <map>
# include <iomanip>

using namespace std;

// Round 221 CF

char M[5003][5003];
int R[5003][5003];
int cum[5003];

int main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    int n,m,ans=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> M[i];
    for (int j = 1; j <= m; j++) {
        memset(cum, 0, sizeof cum);
        for (int i = 0; i < n; i++) {
            if (M[i][j-1] == '1') R[i][j] = R[i][j-1] + 1;
            cum[R[i][j]]++;
        }
        for (int i = m; i > 0; i--) {
            cum[i] += cum[i+1];
            int p = cum[i]*i;
            if (p > ans) ans = p;
        }
    }
    cout << ans;
    return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;
int n,m,aria,i,j,a[5002][5002],x[5002],CNT;
int main()
{
    //freopen("input","r",stdin);
    //freopen("output","w",stdout);

    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            scanf("%1d",&a[i][j]);
    for(j=m;j>=1;j--)
    {
        for(i=1;i<=n;i++)
        if(a[i][j])
        {
            a[i][j]+=a[i][j+1];
            CNT++;
            x[a[i][j]]++;
        }
        for(i=1;CNT;i++)
            if(x[i])
            {
                aria=max(aria,CNT*i);
                CNT-=x[i];
                x[i]=0;
            }
    }
    printf("%d\n",aria);
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;
char a[5002][5002];
int n,m,aria,i,j,x[5002],v[5002],CNT;
int main()
{
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        scanf("%s",a[i]);
    for(j=m-1;j+1;j--)
    {
        for(i=1;i<=n;i++)
        {
            v[i]=a[i][j]-'0'?v[i]+1:0;
            if(v[i]){CNT++;x[v[i]]++;}
        }
        for(i=1;CNT;i++)
        if(x[i])
        {
                aria=max(aria,i*CNT);
                CNT-=x[i];
                x[i]=0;
        }
    }
    printf("%d\n",aria);
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;
set<int>M;
int n,m,aria,i,j,a[5002][5002],x[5002],CNT;
int main()
{
    //freopen("input","r",stdin);
    //freopen("output","w",stdout);

    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            scanf("%1d",&a[i][j]);
    for(j=m;j>=1;j--)
    {
        for(i=1;i<=n;i++)
        if(a[i][j])
        {
            a[i][j]+=a[i][j+1];
            CNT++;
            x[a[i][j]]++;
            M.insert(a[i][j]);
        }
        for(set<int>::iterator it=M.begin();it!=M.end();it++)
            {
                aria=max(aria,*it*CNT);
                CNT-=x[*it];
                x[*it]=0;
            }
        M.clear();
    }
    printf("%d\n",aria);
    return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;
int n,m,aria,i,j,a[5002][5002],x[5002],CNT;
int main()
{
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            scanf("%1d",&a[i][j]);
    for(j=n;j>=1;j--)
    {
        for(i=1;i<=n;i++)
        if(a[i][j])
        {
            a[i][j]+=a[i][j+1];
            CNT++;
            x[a[i][j]]++;
        }
        for(i=1;CNT;i++)
            if(x[i])
            {
                aria=max(aria,CNT*i);
                CNT-=x[i];
                x[i]=0;
            }
    }
    printf("%d\n",aria);
    return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;
int n,m,aria,i,j,a[5002][5002],x[5002],CNT;
int main()
{
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            scanf("%1d",&a[i][j]);
    for(j=n;j>=1;j--)
    {
        for(i=1;i<=n;j++)
        if(a[i][j])
        {
            a[i][j]+=a[i][j+1];
            CNT++;
            x[a[i][j]]++;
        }
        for(i=1;CNT;i++)
            if(x[i])
            {
                aria=max(aria,CNT*i);
                CNT-=x[i];
                x[i]=0;
            }
    }
    printf("%d\n",aria);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

char a[5100][5100];
int pd[5100][5100];

int n, m;

int main(){
	scanf(" %d %d ", &n, &m);
	char c;
	REP(i, n) scanf(" %s ", &a[i][0]);

	CLEAR0(pd);
	for(int i = 0; i<n; i++){
		REP(j, m){
			pd[i][j] = a[i][j]-'0';
			if(a[i][j] == '1' && j > 0) pd[i][j] += pd[i][j-1];
		}
	}

	int ans = 0;
	for(int j = 0; j<m; j++){
		int cnt[5001]; CLEAR0(cnt);
		for(int i = 0; i<n; i++) cnt[pd[i][j]]++;
		int base = 0, height;
		for(int j = m; j>=0; j--){
			if(cnt[j] > 0){
				height = j;
				base += cnt[j];
				//cout << " BASE " << base << " HEIGHT " << height << endl;
				int area = base * height;
				ans = max(area, ans);
			}
		}
	}
	cout << ans << endl;

}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

int a[5100][5100];
int pd[5100][5100];
int n, m;

int main(){
    scanf(" %d %d ", &n, &m);
    char c;
    REP(i, n)
    REP(j, m){
        scanf(" %c ", &c);
        a[m-1-j][i] = (c == '1');
    }

    swap(n, m);
    CLEAR0(pd);

    REP(j, m)
    for(int i = 0; i<n; i++){
        pd[i][j] = a[i][j];
        if(a[i][j] == 1 && i > 0) pd[i][j] += pd[i-1][j];
    }

    /*
    REP(i, n){
        REP(j, m) cout << pd[i][j] << " ";
        cout << endl;
    }*/

    int ans = 0;
    for(int i = 0; i<n; i++){
        int cnt[5001]; CLEAR0(cnt);
        for(int j = 0; j<m; j++) cnt[pd[i][j]]++;
        int p = 0;
        for(int j = n; j>=0; j--){
            while(cnt[j]--) pd[i][p++] = j;
        }
        for(int j = 0; j<m; j++){
            //cout << " i " << i << " j " << j << " " << pd[i][m-1-j] << endl;
            int area = pd[i][j]*(j+1);
            ans = max(area, ans);
        }
    }
    cout << ans << endl;

}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

char a[5100][5100];
int pd[5100][5100];

int n, m;

int main(){
    scanf(" %d %d ", &n, &m);
    char c;
    REP(i, n) cin.getline(&a[i][0], 5100);

    CLEAR0(pd);
    for(int i = 0; i<n; i++){
        REP(j, m){
            pd[i][j] = a[i][j]-'0';
            if(a[i][j] == '1' && j > 0) pd[i][j] += pd[i][j-1];
        }
    }

    int ans = 0;
    for(int j = 0; j<m; j++){
        int cnt[5001]; CLEAR0(cnt);
        for(int i = 0; i<n; i++) cnt[pd[i][j]]++;
        int base = 0, height;
        for(int j = m; j>=0; j--){
            if(cnt[j] > 0){
                height = j;
                base += cnt[j];
                //cout << " BASE " << base << " HEIGHT " << height << endl;
                int area = base * height;
                ans = max(area, ans);
            }
        }
    }
    cout << ans << endl;

}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

char a[5100][5100];
int pd[5100][5100];

int n, m;

int main(){
    scanf(" %d %d ", &n, &m);
    char c;
    REP(i, n) cin.getline(&a[i][0], 5100);

    swap(n, m);
    CLEAR0(pd);

    for(int i = 0; i<n; i++){
        REP(j, m){
            pd[i][j] = a[i][j]-'0';
            if(a[i][j] == '1' && j > 0) pd[i][j] += pd[i][j-1];
        }
    }

    int ans = 0;
    for(int j = 0; j<m; j++){
        int cnt[5001]; CLEAR0(cnt);
        for(int i = 0; i<n; i++) cnt[pd[i][j]]++;
        int base = 0, height;
        for(int i = n; i>=0; i--){
            if(cnt[i] > 0){
                height = i;
                base += cnt[i];
                int area = base * height;
                ans = max(area, ans);
            }
        }
    }
    cout << ans << endl;

}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

int a[5100][5100];
int pd[5100][5100];
int n, m;

int main(){
    scanf(" %d %d ", &n, &m);
    char c;
    REP(i, n)
    REP(j, m){
        scanf(" %c ", &c);
        a[m-1-j][i] = (c == '1');
    }

    swap(n, m);
    CLEAR0(pd);

    REP(j, m)
    for(int i = 0; i<n; i++){
        pd[i][j] = a[i][j];
        if(a[i][j] == 1 && i > 0) pd[i][j] += pd[i-1][j];
    }

    /*
    REP(i, n){
        REP(j, m) cout << pd[i][j] << " ";
        cout << endl;
    }*/

    int ans = 0;
    for(int i = 0; i<n; i++){
        sort(&pd[i][0], &pd[i][0]+m);
        for(int j = 0; j<m; j++){
            //cout << " i " << i << " j " << j << " " << pd[i][m-1-j] << endl;
            int area = pd[i][m-1-j]*(j+1);
            ans = max(area, ans);
        }
    }
    cout << ans << endl;

}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <tr1/unordered_map>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
///////////////////////////////UTIL/////////////////////////////////
#define ALL(x) (x).begin(),x.end()
#define CLEAR0(v) memset(v, 0, sizeof(v))
#define CLEAR(v, x) memset(v, x, sizeof(v))
#define INRANGE0(x, n) ((x) > -1 && (x) < n)
#define INRANGE(x, a, b) ((x) >= a && (x) <= b)
#define COPY(a, b) memcpy(a, b, sizeof(a))
#define CMP(a, b) memcmp(a, b, sizeof(a))
#define REP(i,n) for(int i = 0; i<n; i++)
#define REPP(i,a,n) for(int i = a; i<n; i++)
#define REPD(i,n) for(int i = n-1; i>-1; i--)
#define REPDP(i,a,n) for(int i = n-1; i>=a; i--)
#define pb push_back
#define pf push_front
#define sz size()
#define mp make_pair
/////////////////////////////NUMERICAL//////////////////////////////
#define INCMOD(a,b,c) (((a)+b)%c)
#define DECMOD(a,b,c) (((a)+c-b)%c)
#define ROUNDINT(a) (int)((double)(a) + 0.5)
#define INF 0x3f3f3f3f
#define EPS 1e-9
/////////////////////////////BITWISE////////////////////////////////
#define CHECK(S, j) (S & (1 << j))
#define CHECKFIRST(S) (S & (-S))  //PRECISA DE UMA TABELA PARA TRANSFORMAR EM INDICE
#define SET(S, j) S |= (1 << j)
#define SETALL(S, j) S = (1 << j)-1  //J PRIMEIROS
#define UNSET(S, j) S &= ~(1 << j)
#define TOOGLE(S, j) S ^= (1 << j)
///////////////////////////////64 BITS//////////////////////////////
#define LCHECK(S, j) (S & (1ULL << j))
#define LSET(S, j) S |= (1ULL << j)
#define LSETALL(S, j) S = (1ULL << j)-1ULL  //J PRIMEIROS
#define LUNSET(S, j) S &= ~(1ULL << j)
#define LTOOGLE(S, j) S ^= (1ULL << j)
//scanf(" %d ", &t);

int a[5100][5100];
int pd[5100][5100];
int n, m;

int main(){
    scanf(" %d %d ", &n, &m);
    char c;
    REP(i, n)
    REP(j, m){
        scanf(" %c ", &c);
        a[m-1-j][i] = (c == '1');
    }

    swap(n, m);
    CLEAR0(pd);

    REP(j, m)
    for(int i = 0; i<n; i++){
        pd[i][j] = a[i][j];
        if(a[i][j] == 1 && i > 0) pd[i][j] += pd[i-1][j];
    }

    /*
    REP(i, n){
        REP(j, m) cout << pd[i][j] << " ";
        cout << endl;
    }*/

    int ans = 0;
    for(int i = 0; i<n; i++){
        int cnt[5001]; CLEAR0(cnt);
        for(int j = 0; j<m; j++) cnt[pd[i][j]]++;
        int base = 0, height;
        for(int j = n; j>=0; j--){
            if(cnt[j] > 0){
                height = j;
                base += cnt[j];
                int area = base * height;
                ans = max(area, ans);
            }
        }
    }
    cout << ans << endl;

}