#include <bits/stdc++.h>
using namespace std;
const int MAX{20};
string A[MAX];
int cs[MAX], rs[MAX];
void solve(int R, int C) {
  for (int(i) = 0; (i) < R; (i)++) {
    for (int(j) = 0; (j) < C; (j)++) {
      if (A[i][j] == 'S') {
        cs[j] = 1;
        rs[i] = 1;
      }
    }
  }
  int ans = 0, x = 0;
  for (int(i) = 0; (i) < C; (i)++) {
    if (cs[i] == 0) {
      ans += R;
      ++x;
    }
  }
  for (int(i) = 0; (i) < R; (i)++) {
    if (rs[i] == 0) ans += (C - x);
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int R, C;
  cin >> R >> C;
  for (int(i) = 0; (i) < R; (i)++) cin >> A[i];
  solve(R, C);
  return 0;
}
