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