#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
template <typename T>
T sqr(T x) {
  return x * x;
}
double sind(double x) { return sin(x * PI / 180); }
double cosd(double x) { return cos(x * PI / 180); }
double tand(double x) { return tan(x * PI / 180); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r, c, i, j, x = 0, y = 0;
  cin >> r >> c;
  vector<string> v;
  bool mark[c + 1];
  memset(mark, 0, sizeof(mark));
  for (i = 0; i < r; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  for (auto i : v) {
    string s;
    bool f = 1;
    s = i;
    for (j = 0; j < c; j++) {
      if (s[j] == 'S') {
        f = 0;
        mark[j] = 1;
      }
    }
    if (f) x++;
  }
  for (i = 0; i < c; i++) {
    if (mark[i] == 0) y++;
  }
  int ans = 0;
  ans += x * c;
  ans += y * (r - x);
  cout << ans;
  return 0;
}
