#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, i;
  cin >> r >> c;
  string s;
  int R[11] = {0}, C[11] = {0};
  for (i = 0; i < r; ++i) {
    cin >> s;
    for (int j = 0; j < c; ++j) {
      if (s[j] == 'S') {
        R[i] = 1;
        C[j] = 1;
      }
    }
  }
  int count = 0;
  for (i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      if (R[i] == 0 || C[j] == 0) {
        count += 1;
      }
    }
  }
  cout << count;
  return 0;
}
