#include <bits/stdc++.h>
using namespace std;
int r, c;
char cake[11][11];
bool eaten[11][11];
bool canEat(int index, int direction) {
  bool eat = false;
  if (direction == 0) {
    for (int i = 0; i < c; i++) {
      if (cake[index][i] == 'S') {
        return false;
      }
      if (eaten[index][i] == false) {
        eat = true;
      }
    }
    return eat;
  }
  if (direction == 1) {
    for (int j = 0; j < r; j++) {
      if (cake[j][index] == 'S') {
        return false;
      }
      if (eaten[j][index] == false) {
        eat = true;
      }
    }
    return eat;
  }
  return true;
}
int num = 0;
void func() {
  int i, j;
  for (i = 0; i < r; i++) {
    if (canEat(i, 0)) {
      for (j = 0; j < c; j++) {
        eaten[i][j] = true;
        num++;
      }
    }
  }
  for (j = 0; j < c; j++) {
    if (canEat(j, 1)) {
      for (i = 0; i < r; i++) {
        if (eaten[i][j] == false) {
          eaten[i][j] = true;
          num++;
        }
      }
    }
  }
}
int main() {
  while (scanf("%d%d", &r, &c) != EOF) {
    int i, j;
    num = 0;
    for (i = 0; i < r; i++) {
      scanf("%s", &cake[i]);
      for (j = 0; j < c; j++) {
        eaten[i][j] = false;
      }
    }
    func();
    printf("%d\n", num);
  }
  return 0;
}
