#include <bits/stdc++.h>
using namespace std;
void solve() {
  int64_t n, m;
  cin >> n >> m;
  char arr[n][m];
  for (int64_t i = 0; i < n; i += 1) {
    for (int64_t j = 0; j < m; j += 1) {
      cin >> arr[i][j];
    }
  }
  int64_t ans = 0;
  for (int64_t i = 0; i < n; i += 1) {
    bool check = true;
    for (int64_t j = 0; j < m; j += 1) {
      if (arr[i][j] == 'S') check = false;
    }
    if (check) {
      for (int64_t j = 0; j < m; j += 1) {
        if (arr[i][j] == '.') {
          ans++;
          arr[i][j] = '0';
        }
      }
    }
  }
  for (int64_t j = 0; j < m; j += 1) {
    bool check = true;
    for (int64_t i = 0; i < n; i += 1) {
      if (arr[i][j] == 'S') check = false;
    }
    if (check) {
      for (int64_t i = 0; i < n; i += 1) {
        if (arr[i][j] == '.') {
          ans++;
          arr[i][j] = '0';
        }
      }
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
}
