#include <bits/stdc++.h>
using namespace std;
int i, j, ans, r, c, er, ec;
char cake[15][15];
int main() {
  while (~scanf("%d%d", &r, &c)) {
    er = ec = 0;
    for (i = 0; i < r; i++) {
      scanf("%s", cake[i]);
      er++;
      for (j = 0; j < c; j++) {
        if (cake[i][j] == 'S') {
          er--;
          break;
        }
      }
    }
    for (j = 0; j < c; j++) {
      ec++;
      for (i = 0; i < r; i++) {
        if (cake[i][j] == 'S') {
          ec--;
          break;
        }
      }
    }
    ans = ec * r + er * c - ec * er;
    cout << ans << endl;
  }
  return 0;
}
