#include <bits/stdc++.h>
int main(void) {
  int n, m, i, j, kq = 0;
  char ch;
  int *r, *c;
  scanf("%d %d\n", &n, &m);
  r = (int *)calloc(n, sizeof(int));
  c = (int *)calloc(m, sizeof(int));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%c", &ch);
      if (ch == 'S') {
        r[i] = 1;
        c[j] = 1;
      }
    }
    if (i < n - 1) scanf("\n");
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if ((r[i] == 0) || (c[j] == 0)) kq++;
  printf("%d", kq);
  return 0;
}
