#include <bits/stdc++.h>
using namespace std;
int r, c, i, j, cou, ans;
map<int, bool> rc, cc;
char p;
int main() {
  cin >> r >> c;
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      cin >> p;
      if (p == 'S') {
        rc[i] = true;
        cc[j] = true;
      }
    }
  }
  for (i = 0; i < r; i++) {
    if (!rc[i]) {
      cou++;
    }
  }
  ans += (c * cou);
  for (i = 0; i < c; i++) {
    if (!cc[i]) {
      ans += (r - cou);
    }
  }
  cout << ans;
}
