#include <bits/stdc++.h>
using namespace std;
int n, m;
char gr[101][101];
bool pode(int a, int b) {
  bool pode1 = 1, pode2 = 1;
  for (int i = 0; i < n; ++i)
    if (gr[i][b] == 'S') pode1 = 0;
  for (int j = 0; j < m; ++j)
    if (gr[a][j] == 'S') pode2 = 0;
  return (pode1 || pode2);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", gr[i]);
  int resp = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) resp += pode(i, j);
  printf("%d\n", resp);
  return 0;
}
