#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  bool rowWithSnake;
  int r, c, cleanRow = 0;
  cin >> r >> c;
  char arr[r][c];
  for (int i = 0; i < r; i++) {
    rowWithSnake = false;
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S') {
        rowWithSnake = true;
      }
    }
    if (rowWithSnake != true) {
      ans += c;
      cleanRow += 1;
    }
  }
  for (int i = 0; i < c; i++) {
    rowWithSnake = false;
    for (int j = 0; j < r; j++) {
      if (arr[j][i] == 'S') {
        rowWithSnake = true;
      }
    }
    if (rowWithSnake != true) {
      ans += (r - cleanRow);
    }
  }
  cout << ans << endl;
  return 0;
}
