#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, s = 0, k = 0;
  char a[12][12];
  cin >> r >> c;
  for (int i = 0; i <= r; i++) {
    a[i][0] = '0';
  }
  for (int i = 0; i <= c; i++) {
    a[0][i] = '0';
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        a[0][j] = '1';
        a[i][0] = '1';
      }
    }
  }
  for (int i = 1; i <= c; i++) {
    if (a[0][i] == '0') {
      s += r;
      k++;
    }
  }
  for (int i = 1; i <= r; i++) {
    if (a[i][0] == '0') {
      s = s + c - k;
    }
  }
  cout << s;
}
