#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int r, c;
  cin >> r >> c;
  char arr[r][c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
    }
  }
  int count = 0, flag = 0, count_dot = 0;
  for (int i = 0; i < r; i++) {
    flag = 0;
    for (int j = 0; j < c; j++) {
      if (arr[i][j] == 'S') {
        flag = 1;
        break;
      }
    }
    if (!flag) {
      for (int j = 0; j < c; j++) {
        if (arr[i][j] == '.') {
          arr[i][j] = '0';
          count++;
        }
      }
    }
  }
  for (int j = 0; j < c; j++) {
    flag = 0;
    for (int i = 0; i < r; i++) {
      if (arr[i][j] == 'S') {
        flag = 1;
        break;
      }
    }
    if (!flag) {
      for (int i = 0; i < r; i++) {
        if (arr[i][j] == '.') {
          arr[i][j] = '0';
          count++;
        }
      }
    }
  }
  cout << count << "\n";
  return 0;
}
