#include <bits/stdc++.h>
using namespace std;
int mpow(int base, long long exp);
void ipgraph(int m);
void DFS(int n);
bool isprime(long long n);
int gcd(int a, int b);
void rstgraph(int n);
const int mod = pow(10, 9) + 7;
const int N = 3e5, M = N;
vector<int> g[N];
int vis[N];
int nodes = 0;
void iluzn() {
  int n, m;
  cin >> n >> m;
  int count = 0;
  vector<string> a(n);
  int i, j;
  for (i = 0; i < n; i++) cin >> a[i];
  bool flag[n][m];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) flag[i][j] = 0;
  }
  for (i = 0; i < n; i++) {
    bool can = 1;
    for (j = 0; j < m; j++) {
      if (a[i][j] == 'S') {
        can = 0;
        break;
      }
    }
    for (j = 0; j < m; j++)
      if (can) {
        if (!flag[i][j]) {
          count++;
          flag[i][j] = 1;
        }
      }
  }
  for (i = 0; i < m; i++) {
    bool can = 1;
    for (j = 0; j < n; j++) {
      if (a[j][i] == 'S') {
        can = 0;
        break;
      }
    }
    if (can) {
      for (j = 0; j < n; j++) {
        if (!flag[j][i]) {
          count++;
          flag[j][i] = 1;
        }
      }
    }
  }
  cout << count << endl;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1, i;
  while (t--) iluzn();
  return 0;
}
int mpow(int base, long long exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  long long rt = sqrt(n);
  for (long long i = 3; i < rt; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void ipgraph(int m) {
  int u, v;
  while (m--) {
    cin >> u >> v;
    g[u].push_back(v);
  }
}
void DFS(int n) {
  ++nodes;
  vis[n] = 1;
  for (vector<int>::iterator i = g[n].begin(); i != g[n].end(); i++) {
    if (!vis[*i]) DFS(*i);
  }
}
void rstgraph(int n) {
  int i;
  for (i = 0; i < n + 1; i++) {
    g[i].clear();
    vis[i] = 0;
  }
  nodes = 0;
}
