#include <bits/stdc++.h>
int main() {
  int r, c;
  scanf("%d %d", &r, &c);
  bool banR[1000] = {false};
  bool banC[1000] = {false};
  char map[100][100];
  for (int i = 0; i < r; i++) {
    scanf("%s", map[i]);
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (map[i][j] == 'S') {
        banR[i] = true;
        banC[j] = true;
      }
    }
  }
  int minus = 0;
  int ans = 0;
  for (int i = 0; i < r; i++) {
    if (banR[i] == false) {
      ans += c;
      minus++;
    }
  }
  for (int i = 0; i < c; i++) {
    if (banC[i] == false && minus <= r) {
      ans += (r - minus);
    }
  }
  printf("%d", ans);
  return 0;
}
