#include <bits/stdc++.h>
using namespace std;
int main() {
  int s[15][15] = {}, n, m, t = 0, i, j, k, yi[15] = {}, yj[15] = {};
  char c;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> c;
      if (c == 'S') {
        yi[i] = 1;
        yj[j] = 1;
      }
    }
  }
  for (i = 1; i <= n; i++)
    if (!(yi[i]))
      for (j = 1; j <= m; j++) s[i][j] = 1;
  for (i = 1; i <= m; i++)
    if (!(yj[i]))
      for (j = 1; j <= n; j++) s[j][i] = 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (s[i][j]) t++;
  cout << t << endl;
  return 0;
}
