#include <bits/stdc++.h>
using namespace std;
inline int toInt(std::string s) {
  int v;
  std::istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline std::string toString(T x) {
  std::ostringstream sout;
  sout << x;
  return sout.str();
}
int main(int argc, const char* argv[]) {
  int r = 0, c = 0;
  string s;
  char a[11][11];
  int ans = 0;
  set<int> tate, yoko;
  cin >> r >> c;
  for (int i = 0; i < r; i++) {
    cin >> s;
    for (int j = 0; j < s.size(); j++) {
      a[i][j] = s[j];
      if (s[j] == 'S') {
        yoko.insert(i);
        tate.insert(j);
      }
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (!yoko.count(i) or !tate.count(j)) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
