#include <bits/stdc++.h>
int main() {
  char a[15][15];
  int b[20][20];
  int n, m, i, j, s, count;
  while (scanf("%d %d", &n, &m) == 2) {
    for (i = 0; i < 15; i++) {
      for (j = 0; j < 15; j++) {
        b[i][j] = 1;
      }
    }
    for (i = 0; i < n; i++) {
      scanf("%s", a[i]);
    }
    count = 0;
    for (i = 0; i < n; i++) {
      s = 0;
      for (j = 0; j < m; j++) {
        if (a[i][j] == 'S') {
          s = 1;
          break;
        }
      }
      if (s == 0) {
        for (j = 0; j < m; j++) {
          if (a[i][j] == '.' && b[i][j] == 1) {
            count++;
            b[i][j] = 0;
          }
        }
      }
    }
    for (j = 0; j < m; j++) {
      s = 0;
      for (i = 0; i < n; i++) {
        if (a[i][j] == 'S') {
          s = 1;
          break;
        }
      }
      if (s == 0) {
        for (i = 0; i < n; i++) {
          if (a[i][j] == '.' && b[i][j] == 1) {
            count++;
            b[i][j] = 0;
          }
        }
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
