#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  string str[n];
  for (long long i = 0; i < n; i++) cin >> str[i];
  long long r = 0, c = 0;
  for (long long i = 0; i < n; i++) {
    bool flag = true;
    for (long long j = 0; j < m; j++) {
      if (str[i][j] == 'S') {
        flag = false;
        break;
      }
    }
    if (flag) {
      r++;
    }
  }
  for (long long i = 0; i < m; i++) {
    bool flag = true;
    for (long long j = 0; j < n; j++) {
      if (str[j][i] == 'S') {
        flag = false;
        break;
      }
    }
    if (flag) {
      c++;
    }
  }
  cout << (r * m) + (c * n) - (r * c);
  return 0;
}
