#include <bits/stdc++.h>
char cake[10][11];
bool mark[10][10] = {};
int main() {
  int r, c;
  scanf("%d %d", &r, &c);
  for (int i = 0; i < r; i++) scanf("%s", cake[i]);
  for (int i = 0; i < r; i++) {
    bool flag = false;
    for (int j = 0; j < c; j++)
      if (cake[i][j] == 'S') {
        flag = true;
        break;
      }
    if (!flag)
      for (int j = 0; j < c; j++) mark[i][j] = true;
  }
  for (int i = 0; i < c; i++) {
    bool flag = false;
    for (int j = 0; j < r; j++)
      if (cake[j][i] == 'S') {
        flag = true;
        break;
      }
    if (!flag)
      for (int j = 0; j < r; j++) mark[j][i] = true;
  }
  int ans = 0;
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++)
      if (mark[i][j]) ans++;
  printf("%d\n", ans);
}
