#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int r, c;
  cin >> r >> c;
  vector<string> cake(r);
  for (int i = 0; i < r; i++) cin >> cake[i];
  int ans = r * c;
  vector<bool> rb(r, 0), cb(c, 0);
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (cake[i][j] == 'S') {
        rb[i] = 1;
        cb[j] = 1;
      }
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (rb[i] == 1 && cb[j] == 1) ans--;
    }
  }
  cout << ans;
  return 0;
}
