#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#include <stack>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int H,W;
vector<string> S;

int same[2020][2020];
int diff[2020][2020];

void preprocess(){
    rep(i,H) rep(j,W){
        if(j==0) continue;
        if(S[i][j]==S[i][j-1]) same[i][j]=1;
        if(i>0&&S[i][j]==S[i][j-1]) same[i][j]+=same[i-1][j];
    }
    rep(i,H) rep(j,W){
        if(j==0) continue;
        if(S[i][j]!=S[i][j-1]) diff[i][j]=1;
        if(i>0&&S[i][j]!=S[i][j-1]) diff[i][j]+=diff[i-1][j];
    }
}

int calc(vector<int> &P){
    stack<pair<int,int>> st;
    int res=0;
    rep(j,W){
        if(j==0) continue;
        int pos=j;
        while(st.size()&&st.top().first>=P[j]){
            auto f=st.top();
            st.pop();
            pos=f.second;
            chmax(res,f.first*(j-pos+1));
        }
        st.push(mkp(P[j],pos));
    }
    while(st.size()){
        auto f=st.top();
        st.pop();
        chmax(res,f.first*(W+1-f.second));
    }

    return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin>>H>>W;
  S.resize(H);
  rep(i,H) cin>>S[i];

  preprocess();

  int ans=max(H,W);
  rep(i,H){
      if(i==0) continue;
      {
          vector<int> P(W,0);
          vector<int> rev(W,0);
          rep(j,W) if(S[i][j]=='.') rev[j]=1;
          rep(j,W){
              if(j==0) continue;
              if(rev[j]==rev[j-1]) P[j]=same[i][j];
              else P[j]=diff[i][j];
          }
          chmax(ans,calc(P));
      }

      {
          vector<int> P(W,0);
          vector<int> rev(W,0);
          rep(j,W) if(S[i][j]!='.') rev[j]=1;
          rep(j,W){
              if(j==0) continue;
              if(rev[j]==rev[j-1]) P[j]=same[i][j];
              else P[j]=diff[i][j];
          }
          chmax(ans,calc(P));
      }
  }

  cout<<ans<<endl;

  return 0;
}

//    Have a nice day
//    ∠( ᐛ 」∠)

#include<bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define x first
#define y second

using namespace std;

typedef long long LL;
typedef pair<int,int> pii;

template <typename T> inline T read()
{
	T sum=0, fl=1; char ch=getchar();
	for(; !isdigit(ch); ch=getchar()) if(ch=='-') fl=-1;
	for(; isdigit(ch); ch=getchar()) sum=(sum<<3)+(sum<<1)+ch-'0';
	return sum*fl;
}

const int maxn=2000+5;
int n, m, ans;
char s[maxn][maxn];
int l[maxn], r[maxn], h[maxn], c[maxn][maxn];

void Solve()
{
	n=read<int>(), m=read<int>(); ans=max(n, m);
	for(int i=1; i<=n; ++i) scanf("%s", s[i]+1);
	--n, --m;
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=m; ++j)
			if(((s[i][j]=='#')+(s[i+1][j]=='#')+(s[i][j+1]=='#')+(s[i+1][j+1]=='#'))&1);
			else c[i][j]=1;

	for(int i=1; i<=m; ++i) l[i]=r[i]=maxn;
	for(int i=1; i<=n; ++i)
	{
		for(int j=1, p=0; j<=m; ++j)
		{
			if(c[i][j]) ++p; else p=0;
			l[j]=min(l[j], p);
		}
		for(int j=m, p=0; j>=1; --j)
		{
			if(c[i][j]) ++p; else p=0;
			r[j]=min(r[j], p);
		}
		for(int j=1; j<=m; ++j) 
		{
			if(c[i][j]) ++h[j], ans=max(ans, (l[j]+r[j])*(h[j]+1));
			else l[j]=r[j]=maxn, h[j]=0;
		}
	}
	printf("%d\n", ans);
}

int main()
{

   // freopen("081d.in","r",stdin);
    //freopen("081d.out","w",stdout);

    Solve();

    return 0;
}

