#include <bits/stdc++.h>
int main() {
  int r, c;
  scanf("%d%d\n", &r, &c);
  int n, i, j;
  char str[10][10];
  for (i = 0; i < r; i++) gets(str[i]);
  int r1 = 0, c1 = 0;
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++)
      if (str[i][j] == 'S') break;
    if (j == c) r1++;
  }
  for (j = 0; j < c; j++) {
    for (i = 0; i < r; i++)
      if (str[i][j] == 'S') break;
    if (i == r) c1++;
  }
  n = r1 * c + c1 * r - c1 * r1;
  printf("%d\n", n);
}
