#include <bits/stdc++.h>
char cake[15][15];
bool visited[15][15];
using namespace std;
int main() {
  int r = 0, c = 0;
  cin >> r >> c;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> cake[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < r; i++) {
    bool poss = true;
    for (int j = 0; j < c; j++) {
      if (cake[i][j] == 'S') {
        poss = false;
        break;
      }
    }
    if (poss) {
      ans += c;
      for (int j = 0; j < c; j++) {
        visited[i][j] = true;
      }
    }
  }
  for (int i = 0; i < c; i++) {
    int counter = 0;
    bool poss = true;
    for (int j = 0; j < r; j++) {
      if (cake[j][i] == 'S') {
        poss = false;
        break;
      } else if (!visited[j][i]) {
        counter++;
      }
    }
    if (poss) {
      ans += counter;
    }
  }
  cout << ans << endl;
  return 0;
}
