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