#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  int cr = 0;
  int cc = 0;
  cin >> r >> c;
  char a[r][c];
  int ar[r];
  int ac[c];
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        ar[i] = 1;
        ac[j] = 1;
      }
    }
  for (int i = 0; i < r; i++) {
    if (ar[i] != 1) {
      cr++;
    }
  }
  for (int j = 0; j < c; j++) {
    if (ac[j] != 1) {
      cc++;
    }
  }
  cout << cr * c + cc * (r - cr);
  return 0;
}
