#include <bits/stdc++.h>
using namespace std;
int main() {
  char arr[10][10];
  bool check = true;
  int r, c, sum = 0;
  cin >> r >> c;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < r; i++) {
    check = true;
    for (int j = 0; j < c; j++) {
      if (arr[i][j] == 'S') {
        check = false;
        break;
      }
    }
    if (check) {
      sum += c;
      for (int j = 0; j < c; j++) {
        arr[i][j] = 'x';
      }
    }
  }
  for (int j = 0; j < c; j++) {
    check = true;
    for (int i = 0; i < r; i++) {
      if (arr[i][j] == 'S') {
        check = false;
        break;
      }
    }
    if (check) {
      for (int i = 0; i < r; i++) {
        if (arr[i][j] == '.') {
          sum++;
        }
      }
    }
  }
  cout << sum << endl;
  return 0;
}
