#include <bits/stdc++.h>
int r, c;
char map[20][20];
int main() {
  int i, j;
  memset(map, 'S', sizeof(map));
  scanf("%d%d", &r, &c);
  getchar();
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= c; j++) {
      scanf("%c", &map[i][j]);
    }
    getchar();
  }
  int sum = 0;
  int sb = 0;
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= c; j++)
      if (map[i][j] == 'S') break;
    if (j == c + 1) {
      sum += c;
      sb++;
    }
  }
  for (i = 1; i <= c; i++) {
    for (j = 1; j <= r; j++)
      if (map[j][i] == 'S') break;
    if (j == r + 1) sum += r - sb;
  }
  printf("%d\n", sum);
  return 0;
}
