#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, count = 0, num = 0;
  cin >> a >> b;
  bool judge;
  char s[a][b];
  for (int i = 0; i < a; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < a; i++) {
    judge = true;
    for (int j = 0; j < b; j++) {
      if ('S' == s[i][j]) {
        judge = false;
        break;
      }
    }
    if (judge) {
      count += b;
      num++;
    }
  }
  for (int j = 0; j < b; j++) {
    judge = true;
    for (int i = 0; i < a; i++) {
      if ('S' == s[i][j]) {
        judge = false;
        break;
      }
    }
    if (judge) count = count + (a - num);
  }
  cout << count;
  return 0;
}
