#include <bits/stdc++.h>
int i, j, k, m, n, r[20], c[20];
char s[20][20], x;
int main() {
  while (scanf("%d %d", &m, &n) == 2) {
    scanf("%c", &x);
    for (i = 0; i < m; i++) scanf("%s", s[i]);
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (i = 0; i < m; i++) {
      for (j = 0; j < n; j++) {
        if (s[i][j] == 'S') {
          r[i] = 1;
          c[j] = 1;
        }
      }
    }
    k = 0;
    for (i = 0; i < m; i++) {
      for (j = 0; j < n; j++) {
        if (s[i][j] == 'S')
          k++;
        else if (r[i] == 1 && c[j] == 1)
          k++;
      }
    }
    printf("%d\n", m * n - k);
  }
  return 0;
}
