#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, cnt = 0;
  vector<int> row, col;
  cin >> r >> c;
  char arr[r][c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S') {
        row.push_back(i);
        col.push_back(j);
      }
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (!(std::count(row.begin(), row.end(), i) &&
            std::count(col.begin(), col.end(), j)))
        cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
