#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, j, k, r, c, R = 0, C = 0, eat = 0;
  cin >> r >> c;
  char s[109][109];
  for (int i = 0; i < r; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      if (s[i][j] != 'S') {
        R = C = 0;
        for (k = 0; k < r; k++) {
          if (s[k][j] == 'S') R = 1;
        }
        for (k = 0; k < c; k++) {
          if (s[i][k] == 'S') C = 1;
        }
        if (R != 1 || C != 1) {
          eat++;
        }
      }
    }
  }
  cout << eat;
}
