#include <bits/stdc++.h>
using namespace std;
char a[20][20];
int main() {
  int n, m, l = 0, r = 0;
  bool t[20] = {0};
  bool p[20] = {0};
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'S') {
        t[i] = 1;
        p[j] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (t[i] == 0) {
      l += m;
      r++;
    }
  }
  for (int i = 0; i < m; i++) {
    if (p[i] == 0) l += (n - r);
  }
  cout << l << endl;
  return 0;
}
