#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  char a;
  cin >> r >> c;
  int i, j;
  int p[r], q[c], sum = 0;
  for (i = 0; i < r; i++) p[i] = 0;
  for (j = 0; j < c; j++) q[j] = 0;
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      cin >> a;
      if (a == 'S') {
        p[i] = 1;
        q[j] = 1;
      }
    }
  }
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      if (p[i] == 0 || q[j] == 0) sum += 1;
    }
  }
  cout << sum;
  return 0;
}
