#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c, flag, total, row(0), col(0);
  cin >> r >> c;
  char mat[r][c];
  for (int i = 0; i < r; i++) {
    flag = 0;
    for (int j = 0; j < c; j++) {
      cin >> mat[i][j];
      if (mat[i][j] == 'S') {
        flag = 1;
      }
    }
    if (flag == 0) {
      row++;
    }
  }
  for (int i = 0; i < c; i++) {
    flag = 0;
    for (int j = 0; j < r; j++) {
      if (mat[j][i] == 'S') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      col++;
    }
  }
  total = row * c + col * r;
  cout << total - (row * col) << "\n";
  return 0;
}
