#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  bool flag;
  vector<vector<char> > v(r, vector<char>(c));
  for (int i = 0; i <= r - 1; i += 1)
    for (int j = 0; j <= c - 1; j += 1) cin >> v[i][j];
  int cakes = 0, cols = 0, rows = 0;
  for (int j = 0; j <= c - 1; j += 1) {
    flag = false;
    for (int i = 0; i <= r - 1; i += 1) {
      if (v[i][j] == 'S') {
        flag = true;
        break;
      }
    }
    if (!flag) cols++;
  }
  for (int i = 0; i <= r - 1; i += 1) {
    flag = false;
    for (int j = 0; j <= c - 1; j += 1) {
      if (v[i][j] == 'S') {
        flag = true;
        break;
      }
    }
    if (!flag) rows++;
  }
  cakes = cols * r + (rows * c - rows * cols);
  cout << cakes;
  return 0;
}
