#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, x = 0, ans = 0;
  bool prf;
  cin >> n >> m;
  char matrix[n + 1][m + 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> matrix[i][j];
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      if (matrix[i][j] == 'S') {
        prf = true;
        break;
      }
    }
    if (!prf) {
      x++;
      ans += n;
    }
    prf = false;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (matrix[i][j] == 'S') {
        prf = true;
        break;
      }
    }
    if (!prf) {
      ans += (m - x);
    }
    prf = false;
  }
  cout << ans;
  return 0;
}
