#include <bits/stdc++.h>
using namespace std;
char a[15][15];
int q[15], p[15];
int main() {
  int r, c;
  cin >> r >> c;
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) cin >> a[i][j];
  memset(q, sizeof q, 0);
  memset(p, sizeof p, 0);
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (a[i][j] == 'S') {
        q[i] = 1, p[j] = 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < r; i++) {
    if (q[i] == 0) {
      for (int j = 0; j < c; j++) {
        if (a[i][j] == '.') {
          ans++;
          a[i][j] = ',';
        }
      }
    }
  }
  for (int i = 0; i < c; i++) {
    if (p[i] == 0) {
      for (int j = 0; j < r; j++) {
        if (a[j][i] == '.') {
          ans++;
          a[j][i] = ',';
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
