#include <bits/stdc++.h>
using namespace std;
int prime(int);
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  string arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int count = 0, flag = 0, tmp = 0;
  for (int i = 0; i < n; i++) {
    flag = 0;
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 'S') flag = 1;
    }
    if (flag == 0) {
      count += m;
      tmp++;
    }
  }
  for (int i = 0; i < m; i++) {
    flag = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j][i] == 'S') flag = 1;
    }
    if (flag == 0) count += n - tmp;
  }
  cout << count;
}
int prime(int n) {
  if (n <= 1) return 0;
  int flag = 0;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    return 1;
  else
    return 0;
}
