#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, count = 0;
  cin >> n >> m;
  char x;
  vector<int> r, c;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x;
      if (x == 'S') {
        r.push_back(i);
        c.push_back(j);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((find(r.begin(), r.end(), i) != r.end()) &&
          (std::find(c.begin(), c.end(), j) != c.end())) {
        continue;
      } else {
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
