#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  string cad;
  cin >> n >> m;
  vector<int> filas(n, 0);
  vector<int> cols(m, 0);
  for (int i = 0; i < n; i++) {
    cin >> cad;
    for (int j = 0; j < cad.size(); j++) {
      if (cad[j] == 'S') {
        filas[i] = 1;
        cols[j] = 1;
      }
    }
  }
  int f = count(filas.begin(), filas.end(), 0);
  int c = count(cols.begin(), cols.end(), 0);
  int tot = f * m + c * n - c * f;
  cout << tot << "\n";
}
