#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int n,m,ans,a[1005][1005],s[1005],l[1005];
char c[5];
void work(int h[])
{
int top=0,len; s[top]=0; l[top]=0;
for (int i=1;i<=m;i++)
{
if (h[i]>=s[top])
{
s[++top]=h[i];
l[top]=1;
}
else
{
len=0;
while (top&&s[top]>h[i])
{
len+=l[top];
ans=max(ans,len*s[top]);
top--;
}
s[++top]=h[i];
l[top]=len+1;
}
}
len=0;
while (top)
{
len+=l[top];
ans=max(ans,len*s[top]);
top--;
}
}
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
{
scanf("%s",c);
if (c[0]==‘F‘) a[i][j]=a[i-1][j]+1;
}
ans=0;
for (int i=1;i<=n;i++) work(a[i]);
printf("%d",3*ans);
}