#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, a = 0, b = 0;
  cin >> r >> c;
  char ar[r][c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> ar[i][j];
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (ar[i][j] == 'S') {
        a++;
        break;
      }
    }
  }
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < r; j++) {
      if (ar[j][i] == 'S') {
        b++;
        break;
      }
    }
  }
  cout << (r * c) - (a * b);
  return 0;
}
