#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  int evil[15][15] = {0};
  char a;
  int count;
  int ans = 0;
  count = 0;
  int p, l;
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      cin >> a;
      if (a == 'S') {
        evil[i][j]++;
      }
    }
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      if (evil[i][j] == 1) {
        count = 0;
        break;
      } else {
        p = i;
        count++;
      }
    }
    if (count != 0) {
      for (int k = 1; k <= c; k++) {
        evil[p][k] = 2;
      }
    }
  }
  for (int i = 1; i <= c; i++) {
    for (int j = 1; j <= r; j++) {
      if (evil[j][i] == 1) {
        count = 0;
        break;
      } else {
        l = i;
        count++;
      }
    }
    if (count != 0) {
      for (int k = 1; k <= r; k++) {
        evil[k][l] = 2;
      }
    }
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      if (evil[i][j] == 2) {
        ans++;
      }
    }
  }
  cout << ans;
}
