#include <bits/stdc++.h>
int main() {
  static char s[10][10 + 1];
  int n, n_, m, m_, i, j, good;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  n_ = m_ = 0;
  for (i = 0; i < n; i++) {
    good = 1;
    for (j = 0; j < m; j++)
      if (s[i][j] == 'S') {
        good = 0;
        break;
      }
    if (good) n_++;
  }
  for (j = 0; j < m; j++) {
    good = 1;
    for (i = 0; i < n; i++)
      if (s[i][j] == 'S') {
        good = 0;
        break;
      }
    if (good) m_++;
  }
  printf("%d\n", n_ * m + m_ * n - n_ * m_);
  return 0;
}
