#include <bits/stdc++.h>
using namespace std;
int main() {
  int r[10], c[10];
  int n, m, i, j, row, col;
  while (~scanf("%d%d", &n, &m)) {
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++) {
        char s;
        cin >> s;
        if (s == 'S') {
          r[i]++;
          c[j]++;
        }
      }
    row = col = 0;
    for (i = 0; i < n; i++)
      if (r[i] == 0) row++;
    for (j = 0; j < m; j++)
      if (c[j] == 0) col++;
    if (row != 0 && col != 0)
      printf("%d\n", row * m + col * n - row * col);
    else
      printf("%d\n", row * m + col * n);
  }
  return 0;
}
