#include <bits/stdc++.h>
using namespace std;
int n, m;
int r[11], c[11];
int ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      char ch;
      cin >> ch;
      if (ch == 'S') r[i] = c[j] = 1;
    }
  ans = n * m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (r[i] && c[j]) ans--;
  cout << ans << endl;
  return 0;
}
