#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll H, W;
bool bo[2010][2010];
bool mark[2010][2010];
ll ht[2010][2010];

void mkht() {
    REP (i, 0, W - 1) {
        if (mark[0][i]) {
            ht[0][i] = 1;
        } else {
            ht[0][i] = 0;
        }
    }
    REP (i, 1, H - 1) {
        REP (j, 0, W - 1) {
            if (mark[i][j]) {
                ht[i][j] = ht[i - 1][j] + 1;
            } else {
                ht[i][j] = 0;
            }
        }
    }
}

ll solve() {
    ll ans = max(H, W);
    REP (i, 0, H - 1) {
        stack<plglg> st;
        REP (j, 0, W - 1) {
            if (st.empty()) {
                st.push(plglg(ht[i][j], j));
            } else {
                plglg p = st.top();
                if (p.first < ht[i][j]) {
                    st.push(plglg(ht[i][j], j));
                } else if (p.first > ht[i][j]) {
                    ll pos = j;
                    while (!st.empty() && st.top().first >= ht[i][j]) {
                        plglg pre = st.top();
                        st.pop();
                        ll area = (pre.first + 1) * (j - pre.second + 1);
                        ans = max(ans, area);
                        pos = pre.second;
                    }
                    st.push(plglg(ht[i][j], pos));
                }
            }
        }
        while (!st.empty()) {
            plglg pre = st.top();
            st.pop();
            ll area = (pre.first + 1) * (W - 1 - pre.second + 1);
            ans = max(ans, area);
        }
    }
    return ans;
}

int main() {
    cin >> H >> W;
    REP (i, 0, H) {
        string s;
        cin >> s;
        REP (j, 0, W) {
            if (s[j] == '#') {
                bo[i][j] = true;
            } else {
                bo[i][j] = false;
            }
        }
    }
    // REP (i, 0, H) {
    //     REP (j, 0, W) {
    //         cout << bo[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    REP (i, 0, H - 1) {
        REP (j, 0, W - 1) {
            ll num = 0;
            REP (k, 0, 2) {
                REP (l, 0, 2) {
                    if (bo[i + k][j + l]) {
                        num++;
                    }
                }
            }
            if (num % 2 == 0) {
                mark[i][j] = true;
            } else {
                mark[i][j] = false;
            }
        }
    }
    // REP (i, 0, H - 1) {
    //     REP (j, 0, W - 1) {
    //         cout << mark[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    mkht();
    // REP (i, 0, H - 1) {
    //     REP (j, 0, W - 1) {
    //         cout << ht[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    ll ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 39808