#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, c1 = 0, c2 = 0;
  cin >> r >> c;
  string s[r];
  for (int i = 0; i < r; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (s[i][j] == 'S') {
        c1++;
        break;
      }
    }
  }
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < r; j++) {
      if (s[j][i] == 'S') {
        c2++;
        break;
      }
    }
  }
  cout << (r * c) - (c1 * c2) << endl;
}
