#include<cstdio>
int H,W,A[2010][2010],h[2010],l[2010],stk[2010];
char S[2010][2010];
void cmax(int&a,int b){b>a?a=b:1;}
int main(){
	scanf("%d%d",&H,&W);
	for(int i=0;i<H;i++){
		scanf("%s",S[i]);
		for(int j=0;j<W;j++){
			S[i][j]=S[i][j]=='#';
			if(i&&j)A[i][j]=S[i][j]^S[i][j-1]^S[i-1][j]^S[i-1][j-1]^1;
		}
	}
	int ans=H>W?H:W;
	for(int i=1;i<H;i++){
		int*tp=stk;
		for(int j=1;j<=W;j++){
			h[j]=A[i][j]?h[j]+1:0;
			for(;tp>stk&&h[*tp]>=h[j];--tp)
				cmax(ans,(j-l[*tp])*(h[*tp]+1));
			l[j]=*tp;
			*++tp=j;
		}
	}
	printf("%d\n",ans);
}
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

template<class T>
map<T,T> fact(T n){
    map<T,T> Map;
    for(T i = 2; i * i <= n; i++){
        while(n % i == 0){
            Map[i]++;
            n /= i;
        }
    }
    if(n == 1)return Map;
    Map[n]++;
    return Map;
}


int main()
{
    ll a, b;
    cin >> a >> b;
    ll gc = gcd(a, b);
    cout << fact(gc).size() + 1 << endl;
}