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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int i = 0; i < H; i++) cin >> S[i];
	vector<vector<int> > A(H, vector<int>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '.') A[i][j] = 0;
			else A[i][j] = 1;
		}
	}
	vector<vector<int> > B(H, vector<int>(W - 1));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W - 1; j++) {
			B[i][j] = A[i][j] ^ A[i][j + 1];
		}
	}
	vector<vector<int> > C(H, vector<int>(W - 1));
	for (int i = 0; i < W - 1; i++) {
		C[H - 1][i] = 1;
		for (int j = H - 2; j >= 0; j--) {
			if (B[j + 1][i] == B[j][i]) C[j][i] = C[j + 1][i] + 1;
			else C[j][i] = 1;
		}
	}
	int ANS = 0;
	for (int i = 0; i < H; i++) {
		stack<pair<int, int> > ST;
		ST.push({ C[i][0], 0 });
		for (int j = 1; j < W - 1; j++) {
			int X = j;
			while (!ST.empty() && ST.top().first > C[i][j]) {
				ANS = max(ANS, ST.top().first * (j - ST.top().second + 1));
				X = ST.top().second;
				ST.pop();
			}
			ST.push({ C[i][j], X });
		}
		while (!ST.empty()) {
			ANS = max(ANS, ST.top().first * (W - ST.top().second));
			ST.pop();
		}
	}
	cout << max(ANS, max(H, W)) << endl;
}
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

char grid[2005][2005];
int tok[2005][2005];
int h[2005], w[2005];

int R, C;

int main(){

    ios :: sync_with_stdio(false);
    cin >> R >> C;
    FOR(i,R) FOR(j,C){
        cin >> grid[i][j];
    }

    int ans = max(R,C);
    FOR(i,R-1){
        FOR(j,C-1){
            int black = (grid[i][j] == '#') + (grid[i][j+1] == '#') + (grid[i+1][j] == '#') + (grid[i+1][j+1] == '#');
            tok[i][j] = black&1;
        }
    }

    FOR(i,R){
        FOR(j,C-1){
            if(tok[i-1][j]) h[j] = 1;
            else h[j]++;
        }

        int k = 0;
        FOR(j,C-1){
            while(h[j] <= h[w[k]]){
                ans = max(ans, h[w[k]]*(j - w[k-1]));
                k--;
            }
            w[++k] = j;
        }

        while(k > 0){
            ans = max(ans, h[w[k]] * (C - w[k-1]));
            k--;
        }
    }

    cout << ans << endl;
    return 0;
}