#pragma GCC optimize("trapv")
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using vi = vector<int>;
using ll = long long;
const int maxn = 2020, mod = 924844033;
int n, m, a[maxn][maxn], b[maxn][maxn], h[maxn], l[maxn], r[maxn];
int solve() {
	h[0] = h[m] = -1;
	{
		vi s {0};
		for(int i = 1; i < m; i++) {
			while(h[s.back()] >= h[i]) s.pop_back();
			l[i] = s.back();
			s.push_back(i);
		}
	}
	{
		vi s {m};
		for(int i = m-1; i; i--) {
			while(h[s.back()] >= h[i]) s.pop_back();
			r[i] = s.back();
			s.push_back(i);
		}
	}
	int ans = 0;
	for(int i = 1; i < m; i++)
		ans = max(ans, (r[i]-l[i])*h[i]);
	return ans;
}
int ans = 0;
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	ans = max(n, m);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			char t; cin >> t;
			a[i][j] = t=='#';
		}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j < m; j++) {
			b[i][j] = 1;
			if(i && (a[i][j]^a[i][j+1]) == (a[i-1][j]^a[i-1][j+1])) b[i][j] += b[i-1][j];
		}
		for(int j = 1; j <= m; j++) h[j] = b[i][j];
		ans = max(ans, solve());
	}
	cout << ans;
}
