#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int r, c;
  cin >> r >> c;
  char a[r + 1][c + 1];
  set<long long int> s1, s2;
  for (long long int i = 1; i <= r; i++) {
    for (long long int j = 1; j <= c; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        s1.insert(i);
        s2.insert(j);
      }
    }
  }
  cout << (r * c) - (s1.size() * (s2.size()));
}
