#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  char s[15][15];
  int cake = 0;
  int row = 0;
  scanf("%d %d", &r, &c);
  for (int i = 1; i <= r; i++) {
    scanf("%s", s[i]);
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 0; j < c; j++) {
      if (s[i][j] == 'S')
        break;
      else if (s[i][j] == '.' && j == c - 1) {
        cake += c;
        row++;
      }
    }
  }
  for (int j = 0; j < c; j++) {
    for (int i = 1; i <= r; i++) {
      if (s[i][j] == 'S')
        break;
      else if (s[i][j] == '.' && i == r)
        cake += (r - row);
    }
  }
  printf("%d", cake);
  return 0;
}
