#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  int i, j;
  string s;
  bool fr[10] = {false};
  bool fc[10] = {false};
  for (i = 0; i < r; i++) {
    cin >> s;
    for (j = 0; j < c; j++) {
      if (s[j] == 'S') {
        fr[i] = true;
        fc[j] = true;
      }
    }
  }
  int ar = 0;
  int ac = 0;
  for (i = 0; i < r; i++) {
    if (!fr[i]) ar++;
  }
  for (i = 0; i < c; i++) {
    if (!fc[i]) ac++;
  }
  cout << c * ar + r * ac - ar * ac;
  return 0;
}
