#include <bits/stdc++.h>
using namespace std;
long long a, b, d, e, f;
char c;
set<long long> si, sj;
int main() {
  cin >> a >> b;
  for (int i = 1; i <= a; ++i) {
    for (int j = 1; j <= b; ++j) {
      cin >> c;
      if (c == 'S') {
        si.insert(i);
        sj.insert(j);
      }
    }
  }
  d = a * b;
  e = si.size() * sj.size();
  f = d - e;
  cout << f;
  return 0;
}
