/*
   ЗАПУСКАЕМ СТЕНУ ИЗ КРЕМА
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
   💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩
*/

#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#include <stack>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

const int N = 2000 + 1;
const int LIM = (1 << 4);

int arr[N][N];
int need[N][N];
bool good[LIM];

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    int lim = (1 << 4);
    int lm = (1 << 2);
    for (int mask = 0; mask < lim; mask++)
    {
        for (int m_r = 0; m_r < lm; m_r++)
        {
            for (int m_c = 0; m_c < lm; m_c++)
            {
                int ok = 1;
                for (int i = 0; i < 2; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        int res = (mask >> (i * 2 + j)) & 1;
                        res ^= ((m_r >> i) & 1);
                        res ^= ((m_c >> j) & 1);
                        ok &= res;
                    }
                }
                if (ok)
                {
                    good[mask] = true;
                    break;
                }
            }
        }
    }
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            char c;
            scanf(" %c", &c);
            arr[i][j] = (c == '#');
        }
    }
    int ans = max(n, m);
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j < m - 1; j++)
        {
            int mask = 0;
            for (int t = 0; t < 2; t++)
            {
                for (int d = 0; d < 2; d++)
                {
                    if (arr[i + t][j + d])
                    {
                        mask |= (1 << (t * 2 + d));
                    }
                }
            }
            need[i][j] = good[mask];
        }
    }
    n--, m--;
    vector <int> d(m, -1);
    vector <int> d1(m);
    vector <int> d2(m);
    stack <int> st;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (need[i][j] == 0)
            {
                d[j] = i;
            }
        }
        while (!st.empty()) 
        {
            st.pop();
        }
        for (int j = 0; j < m; j++)
        {
            while (!st.empty() && d[st.top()] <= d[j]) 
            {
                st.pop();
            }
            d1[j] = st.empty() ? -1 : st.top();
            st.push (j);
        }
        while (!st.empty()) 
        {
            st.pop();
        }
        for (int j= m - 1; j >= 0; j--)
        {
            while (!st.empty() && d[st.top()] <= d[j]) 
            {
                st.pop();
            }
            d2[j] = st.empty() ? m : st.top();
            st.push (j);
        }
        for (int j = 0; j < m; j++)
        {
            ans = max (ans, (i - d[j] + 1) * (d2[j] - d1[j]));
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 31488