#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  int j, i;
  cin >> r >> c;
  char a;
  map<int, int> m, n;
  for (j = 0; j < r; j++) {
    for (i = 0; i < c; i++) {
      cin >> a;
      if (a == 'S') {
        m[i]++;
        n[j]++;
      }
    }
  }
  cout << (r * c) - (m.size() * n.size());
}
