#include <bits/stdc++.h>
using namespace std;
char s[20][20];
bool k[20][20];
int main() {
  int rsp = 0;
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", s[i]);
  for (int i = 0; i < n; i++) {
    int c = 0;
    for (int j = 0; j < m; j++)
      if (s[i][j] == 'S') c++;
    if (c == 0) {
      for (int j = 0; j < m; j++)
        if (!k[i][j]) {
          k[i][j] = true;
          rsp++;
        }
    }
  }
  for (int j = 0; j < m; j++) {
    int c = 0;
    for (int i = 0; i < n; i++)
      if (s[i][j] == 'S') c++;
    if (c == 0) {
      for (int i = 0; i < n; i++)
        if (!k[i][j]) {
          k[i][j] = true;
          rsp++;
        }
    }
  }
  printf("%d\n", rsp);
  return 0;
}
