#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  string s[r];
  bool flag[r + 2][c + 2];
  fill(&flag[0][0], &flag[r + 1][c + 1], true);
  for (int i = 0; i < r; i++) cin >> s[i];
  int coun = 0;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (s[i][j] != 'S') {
        int k = i;
        int l = j;
        int rc = 0, cc = 0, g, a;
        for (g = 0; g < c; g++) {
          if (s[k][g] == 'S') break;
          if (flag[k][g] == true) rc++;
        }
        if (g == c) {
          coun += rc;
          for (int h = 0; h < c; h++) flag[k][h] = false;
        } else
          rc = 0;
        for (a = 0; a < r; a++) {
          if (s[a][l] == 'S') break;
          if (flag[a][l] == true) cc++;
        }
        if (a == r) {
          coun += cc;
          for (int c = 0; c < r; c++) flag[c][l] = false;
        } else
          cc = 0;
        rc = 0;
        cc = 0;
      }
    }
  }
  cout << coun << endl;
}
