#include <bits/stdc++.h>
using namespace std;
char a[11][11];
int n, m;
bool ok = 0;
int ans;
bool eat[11][11] = {0};
int main() {
  cin >> 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++) {
    ok = 1;
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'S') {
        ok = 0;
        break;
      }
    }
    if (ok == 1) {
      for (int e = 0; e < m; e++) eat[i][e] = 1;
    }
  }
  for (int j = 0; j < m; j++) {
    ok = 1;
    for (int i = 0; i < n; i++) {
      if (a[i][j] == 'S') {
        ok = 0;
        break;
      }
    }
    if (ok == 1) {
      for (int e = 0; e < n; e++) eat[e][j] = 1;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (eat[i][j] == 1) ans++;
  cout << ans << endl;
  return 0;
}
