#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int r, c;
  cin >> r >> c;
  char arr[20][20];
  int col[20] = {0}, row[20] = {0};
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S') {
        col[i] = 1;
        row[j] = 1;
      }
    }
  }
  int countCol = 0, countRow = 0;
  for (int i = 0; i < 20; ++i) {
    countCol += col[i];
    countRow += row[i];
  }
  cout << r * c - countCol * countRow;
}
