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