#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  while (cin >> r >> c) {
    string Cake[r];
    bool sw;
    string aux = "";
    for (int j = 0; j < c; j++) {
      aux = aux + "*";
    }
    for (int i = 0; i < r; i++) {
      sw = true;
      cin >> Cake[i];
      for (int j = 0; j < c; j++) {
        if (Cake[i][j] == 'S') {
          sw = false;
          break;
        }
      }
      if (sw) {
        Cake[i] = aux;
      }
    }
    for (int i = 0; i < c; i++) {
      sw = true;
      for (int j = 0; j < r; j++) {
        if (Cake[j][i] == 'S') {
          sw = false;
          break;
        }
      }
      if (sw) {
        for (int j = 0; j < r; j++) {
          Cake[j][i] = '*';
        }
      }
    }
    int cont = 0;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        if (Cake[i][j] == '*') {
          cont++;
        }
      }
    }
    cout << cont << endl;
  }
  return 0;
}
