#include <bits/stdc++.h>
using namespace std;
char table[10][10], lin[10], col[10];
int ans[10][10];
int r, c, res;
void print() {
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      printf("%d ", ans[i][j]);
    }
    printf("\n");
  }
  printf("\n");
}
int main() {
  scanf("%d%d", &r, &c);
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      scanf(" %c", &table[i][j]);
      if (table[i][j] == 'S') lin[i]++, col[j]++;
    }
  }
  for (int i = 0; i < r; i++)
    if (!lin[i]) {
      for (int j = 0; j < c; j++) ans[i][j] = 1;
    }
  for (int i = 0; i < c; i++)
    if (!col[i]) {
      for (int j = 0; j < r; j++) ans[j][i] = 1;
    }
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++)
      if (ans[i][j]) res++;
  printf("%d\n", res);
  return 0;
}
