#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  char arr[r][c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
    }
  }
  int count_row = 0, count_col = 0;
  for (int i = 0; i < r; i++) {
    int row = 0;
    for (int j = 0; j < c; j++) {
      if (arr[i][j] == 'S') {
        row = 0;
        break;
      } else {
        row = 1;
      }
    }
    count_row += row;
  }
  for (int i = 0; i < c; i++) {
    int col = 0;
    for (int j = 0; j < r; j++) {
      if (arr[j][i] == 'S') {
        col = 0;
        break;
      } else {
        col = 1;
      }
    }
    count_col += col;
  }
  int ans = (count_row * c) + ((count_col * r) - (count_row * count_col));
  cout << ans << endl;
  return 0;
}
