#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  bool r[n], c[m];
  for (int i = 0; i < n; i++) r[i] = 0;
  for (int j = 0; j < m; j++) c[j] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'S') r[i] = 1, c[j] = 1;
  int x = n * m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (r[i] == 1 && c[j] == 1) x--;
  cout << x;
}
