#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char c[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c[i][j];
    }
  }
  int e = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j] == 'S') {
        e++;
        continue;
      }
      int ro = 0, co = 0;
      for (int k = 0; k < n; k++) {
        if (c[k][j] == 'S') {
          ro = 1;
          break;
        }
      }
      if (ro == 0) {
        continue;
      }
      for (int k = 0; k < m; k++) {
        if (c[i][k] == 'S') {
          co = 1;
          break;
        }
      }
      if (ro == 1 && co == 1) {
        e++;
      }
    }
  }
  cout << n * m - e;
}
