#include <bits/stdc++.h>
using namespace std;

const int maxn = 2010;
int H, W, f[maxn][maxn], pre[maxn], suf[maxn];
char s[maxn][maxn];
bool chk[maxn][maxn];

int main() {
    scanf("%d %d", &H, &W);
    for (int i = 1; i <= H; i++) {
        scanf("%s", s[i] + 1);
        for (int j = 1; j <= W; j++) {
            if (i > 1 && j > 1) {
                int cnt = (s[i][j] == '.') + (s[i - 1][j] == '.') +
                    (s[i][j - 1] == '.') + (s[i - 1][j - 1] == '.');
                if (cnt & 1) chk[i - 1][j - 1] = 1;
            }
        }
    }
    H--, W--;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            f[i][j] = chk[i][j] ? 0 : (f[i - 1][j] + 1);
        }
    }
    int ans = max(H + 1, W + 1);
    for (int i = 1; i <= H; i++) {
        stack<int> st;
        f[i][0] = f[i][W + 1] = -1;
        st.push(0);
        for (int j = 1; j <= W; j++) {
            while (f[i][st.top()] >= f[i][j]) st.pop();
            pre[j] = st.top(), st.push(j);
        }
        while (!st.empty()) st.pop();
        st.push(W + 1);
        for (int j = W; j; j--) {
            while (f[i][st.top()] >= f[i][j]) st.pop();
            suf[j] = st.top(), st.push(j);
        }
        for (int j = 1; j <= W; j++) {
            ans = max(ans, (f[i][j] + 1) * (suf[j] - pre[j]));
        }
    }
    printf("%d\n", ans);
    return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
//const int mod = 1e9 + 7;
const int mod = 998244353;

int main(){
	int h,w; cin >> h >> w;
	vs s(h); rep(i,h) cin >> s[i];
	vl dist(h+1,-1);
	int ans = w;
	rep(j,w){
		vector<pii> st;
		st.emplace_back(0,0);
		REP(i,1,h+1){
			if(i < h){
				if(j==0 || dist[i] == 1){
					int d = 0;
					bool rev = s[i][j] != s[i-1][j];
					REP(k,j,w){
						if(rev == (s[i][k] != s[i-1][k])) d++;
						else break;
					}
					dist[i] = d;
				}else{
					dist[i]--;
				}
			}else{
				dist[i] = 0;
			}
			if(st.empty() || st.back().first < dist[i]){
				st.emplace_back(dist[i],i);
			}else{
				int pos = i;
				while(!st.empty()){
					if(st.back().first >= dist[i]){
						pii p = st.back();
						chmax(ans, p.first*(i-p.second)+p.first);
						pos = p.second;
						st.pop_back();
					}else{
						st.emplace_back(dist[i], pos);
						break;
					}
				}
			}
		}
	}
	cout << ans << "\n";
}