#include <bits/stdc++.h>
int main() {
  char arr[10][10];
  int r, c, i, flag, count, j, k, l, m, n;
  scanf("%d %d", &r, &c);
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      scanf(" %c", &arr[i][j]);
    }
  }
  count = 0;
  for (k = 0; k < r; k++) {
    flag = 1;
    for (l = 0; l < c; l++) {
      if (arr[k][l] == 'S') {
        flag = 0;
        break;
      }
    }
    if (flag) {
      for (m = 0; m < c; m++) {
        if (arr[k][m] == '.') {
          count++;
          arr[k][m] = '-';
        }
      }
    }
  }
  for (i = 0; i < c; i++) {
    flag = 1;
    for (j = 0; j < r; j++) {
      if (arr[j][i] == 'S') {
        flag = 0;
        break;
      }
    }
    if (flag) {
      for (k = 0; k < r; k++) {
        if (arr[k][i] == '.') {
          count++;
          arr[k][i] = '-';
        }
      }
    }
  }
  printf("%d", count);
  return 0;
}
