#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int r, c;
  cin >> r >> c;
  vector<bool> v1(r);
  vector<bool> v2(c);
  string s[r];
  for (int i = 0; i < r; i++) {
    cin >> s[i];
    for (int j = 0; j < c; j++) {
      if (s[i][j] == 'S') {
        v1[i] = true;
        v2[j] = true;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (v1[i] == 0 || v2[j] == 0) count++;
    }
  }
  cout << count << endl;
}
