#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r, c;
  cin >> r >> c;
  vector<string> mat(r);
  for (int i = 0; i < r; i++) cin >> mat[i];
  int rows[r];
  int cols[c];
  for (int i = 0; i < r; i++) rows[i] = 1;
  for (int i = 0; i < c; i++) cols[i] = 1;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (mat[i][j] == 'S') {
        rows[i] = 0;
        cols[j] = 0;
      }
    }
  }
  int eaten = 0;
  for (int i = 0; i < r; i++) {
    if (rows[i]) {
      for (int j = 0; j < c; j++) {
        if (mat[i][j] == '.') {
          eaten++;
          mat[i][j] = 'S';
        }
      }
    }
  }
  for (int i = 0; i < c; i++) {
    if (cols[i]) {
      for (int j = 0; j < r; j++) {
        if (mat[j][i] == '.') {
          eaten++;
          mat[j][i] = 'S';
        }
      }
    }
  }
  cout << eaten << endl;
  return 0;
}
