#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j;
  cin >> n >> m;
  char arr[n][m];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cin >> arr[i][j];
  }
  int c = 0;
  for (i = 0; i < n; i++) {
    int flag = 0;
    for (j = 0; j < m; j++) {
      if (arr[i][j] == 'S') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      for (j = 0; j < m; j++) {
        if (arr[i][j] != 'e') {
          arr[i][j] = 'e';
          c++;
        }
      }
    }
  }
  for (j = 0; j < m; j++) {
    int flag = 0;
    for (i = 0; i < n; i++) {
      if (arr[i][j] == 'S') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      for (i = 0; i < n; i++) {
        if (arr[i][j] != 'e') {
          arr[i][j] = 'e';
          c++;
        }
      }
    }
  }
  cout << c;
}
