#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  int count = 0;
  vector<string> v;
  int k;
  for (int i = 0; i < r; i++) {
    string s;
    cin >> s;
    v.push_back(s);
    k = 0;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == 'S') {
        k = 1;
        break;
      }
    }
    if (k == 0) count++;
  }
  k = 0;
  int sum = 0;
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < r; j++) {
      if (v[j][i] == 'S') {
        k = 1;
        break;
      }
    }
    if (k == 0) sum++;
    k = 0;
  }
  int e = (count * c);
  int y = (sum * r);
  int ey = e + y;
  int u = count * sum;
  int eyu = (ey - u);
  cout << eyu << endl;
}
