#include <bits/stdc++.h>
using namespace std;
long long sum(long long n) {
  string s = to_string(n);
  long long k = 0;
  for (auto ch : s) {
    k += ch - '0';
  }
  return k;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long r, c;
  cin >> r >> c;
  char arr[r][c];
  for (long long i = 0; i < r; i++)
    for (long long j = 0; j < c; j++) cin >> arr[i][j];
  unordered_map<long long, long long> rr, cc;
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) {
      if (arr[i][j] == 'S') rr[i]++, cc[j]++;
    }
  }
  cout << (r * c) - (rr.size() * cc.size());
  return 0;
}
