#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, cakes = 0, columnsEaten = 0, rowsEaten = 0;
  cin >> n >> m;
  char arr[n][m];
  char c;
  bool didnot_found_strawberry;
  for (int i = 0; i < n; i++) {
    didnot_found_strawberry = true;
    for (int j = 0; j < m; j++) {
      cin >> c;
      if (c == 'S') {
        didnot_found_strawberry = false;
      }
      arr[i][j] = c;
    }
    if (didnot_found_strawberry) {
      cakes += m;
      columnsEaten++;
    }
  }
  for (int j = 0; j < m; j++) {
    didnot_found_strawberry = true;
    for (int i = 0; i < n; i++) {
      if (arr[i][j] == 'S') {
        didnot_found_strawberry = false;
      }
    }
    if (didnot_found_strawberry) {
      cakes += n;
      rowsEaten++;
    }
  }
  cout << cakes - (columnsEaten * rowsEaten);
  return 0;
}
