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