#include <bits/stdc++.h>
using namespace std;
bool r[11], c[11];
int main() {
  int x, y, i, j, sum = 0;
  char ch;
  cin >> x >> y;
  memset(r, 0, sizeof(r));
  memset(c, 0, sizeof(c));
  for (i = 1; i <= x; i++)
    for (j = 1; j <= y; j++) {
      cin >> ch;
      if (ch == 'S') {
        r[i] = 1;
        c[j] = 1;
      }
    }
  for (i = 1; i <= x; i++)
    for (j = 1; j <= y; j++) {
      if ((!r[i]) || (!c[j])) sum++;
    }
  cout << sum << endl;
}
