#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, m, j, c[101], b[101], s = 0;
  string a[101];
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    for (j = 0; j < m; j++) {
      if (a[i][j] == 'S') a[i][j] = '1';
      if (a[i][j] == '.') a[i][j] = '0';
    }
  }
  for (i = 0; i < n; i++) b[i] = 0;
  for (j = 0; j < m; j++) c[j] = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      b[i] += (a[i][j] - 48);
      c[j] += (a[i][j] - 48);
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (b[i] == 0) a[i][j] = 'k';
      if (c[j] == 0) a[i][j] = 'k';
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] == 'k') s++;
    }
  }
  cout << s;
  return 0;
}
