#include <bits/stdc++.h>
using namespace std;
int main() {
  char cell;
  short r, c, rr, cc, e;
  int res = 0, i, cat[100], cnt = 0;
  cin >> r >> c;
  rr = r;
  cc = c;
  for (i = 0; i < r; i++) {
    e = 0;
    for (int I = 0; I < c; I++) {
      cin >> cell;
      if (cell == 'S') {
        e++;
        cat[cnt] = I;
        cnt++;
      }
    }
    if (e == 0) {
      res += c;
      rr--;
    }
  }
  cc -= cnt;
  sort(cat, cat + cnt);
  for (i = 1; i < cnt; i++)
    if (cat[i] == cat[i - 1]) cc++;
  res += cc * rr;
  cout << res;
  return 0;
}
