#include <bits/stdc++.h>
using namespace ::std;
int main() {
  long long int i, j, k, r, c;
  cin >> r >> c;
  char a[100][100];
  for (i = 0; i < r; i++) cin >> a[i];
  long long int flag;
  long long int number = 0;
  for (i = 0; i < r; i++) {
    flag = 0;
    for (j = 0; j < c; j++) {
      if (a[i][j] == 'S') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      number += c;
      for (j = 0; j < c; j++) a[i][j] = '1';
    }
  }
  long long int count;
  for (j = 0; j < c; j++) {
    count = 0;
    flag = 0;
    for (i = 0; i < r; i++) {
      if (a[i][j] == 'S') {
        flag = 1;
        break;
      }
      if (a[i][j] == '1') {
        count++;
      }
    }
    if (flag == 0 && count < r) {
      number += r - count;
    }
  }
  cout << number;
}
