#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 2005;
int h, w, c[MX], ans, e, st[MX], hi[MX];
char s[MX][MX];
bool b[MX][MX];
int main(){
	scanf("%d%d", &h, &w);
	ans = max(h,w);
	rep(i,h) scanf("\n%s", s[i]);
	rep(i,h-1) rep(j,w-1) b[i][j]=!(s[i][j]^s[i+1][j]^s[i][j+1]^s[i+1][j+1]);
	rep(i,h-1){
		e = 0;
		rep(j,w){
			while(c[j]<i || b[c[j]][j]) c[j]++;
			if(e && hi[e-1]>c[j]){
				for(;e && hi[e-1]>c[j]; e--) ans = max(ans,(hi[e-1]-i+1)*(j-st[e-1]+1));
			}else st[e] = j;
			hi[e++] = c[j];
		}
	}
	printf("%d\n", ans);
}