#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1011111111;
const long long LLINF = 1000111000111000111LL;
const long double EPS = 1e-10;
const long double PI = 3.14159265358979323;
using namespace std;
long long powm(long long base, long long exp, long long mod = MOD) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % mod;
    exp >>= 1, base = (base * base) % mod;
  }
  return ans;
}
const long long N = 1000005;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int r, c;
  cin >> r >> c;
  vector<vector<char>> v;
  v.resize(r);
  for (int i = 0; i < r; i++) {
    v[i].resize(c);
    for (int j = 0; j < c; j++) {
      cin >> v[i][j];
    }
  }
  int good_rows = 0, good_columns = 0;
  for (int i = 0; i < r; i++) {
    int flag = 0;
    for (int j = 0; j < c; j++) {
      if (v[i][j] == 'S') flag = 1;
    }
    if (flag == 0) good_rows++;
  }
  for (int i = 0; i < c; i++) {
    int flag = 0;
    for (int j = 0; j < r; j++) {
      if (v[j][i] == 'S') flag = 1;
    }
    if (flag == 0) good_columns++;
  }
  cout << c * good_rows + r * good_columns - (good_rows * good_columns);
  return 0;
}
