#include <bits/stdc++.h>
int main(void) {
  int r, c, i, j, flag, count = 0;
  int a[11][11];
  char b[11][11];
  scanf("%d%d", &r, &c);
  getchar();
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      scanf("%c", &b[i][j]);
      if (b[i][j] == 'S')
        a[i][j] = 1;
      else
        a[i][j] = 0;
    }
    getchar();
  }
  for (i = 0; i < r; i++) {
    flag = 1;
    for (j = 0; j < c; j++) {
      if (a[i][j] == 1) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      for (j = 0; j < c; j++)
        if (a[i][j] == 0) {
          a[i][j] = -1;
          count++;
        }
    }
  }
  for (j = 0; j < c; j++) {
    flag = 1;
    for (i = 0; i < r; i++) {
      if (a[i][j] == 1) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      for (i = 0; i < r; i++) {
        if (a[i][j] == 0) {
          a[i][j] = -1;
          count++;
        }
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
