#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  bool ta[r][c];
  char a;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> a;
      if (a == 'S') {
        ta[i][j] = false;
      } else {
        ta[i][j] = true;
      }
    }
  }
  int cn = 0, cm = 0;
  bool flag = true;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (ta[i][j] == false) {
        flag = false;
      }
    }
    if (flag) {
      cn += c;
      cm++;
    }
    flag = true;
  }
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < r; j++) {
      if (ta[j][i] == false) {
        flag = false;
      }
    }
    if (flag) {
      cn += r - cm;
    }
    flag = true;
  }
  cout << cn;
  return 0;
}
