#include <bits/stdc++.h>
using namespace std;
bool Isvalidrow(int arr[], int s) {
  for (int i = 0; i < s; i++) {
    if (arr[i] == -1) {
      return false;
    }
  }
  return true;
}
bool IsvalidCol(int **arr, int r, int c, int j) {
  for (int i = 0; i < r; i++) {
    if (arr[i][j] == -1) return false;
  }
  return true;
}
int main() {
  int r, c;
  cin >> r >> c;
  char arr[r][c];
  cin.ignore();
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> arr[i][j];
    }
  }
  int **sol = new int *[r];
  for (int i = 0; i < r; i++) sol[i] = new int[c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (arr[i][j] == 'S') {
        sol[i][j] = -1;
      } else
        sol[i][j] = 1;
    }
  }
  int count = 0;
  for (int i = 0; i < r; i++) {
    if (Isvalidrow(sol[i], c)) {
      for (int j = 0; j < c; j++) {
        sol[i][j] = 0;
        count++;
      }
    }
  }
  for (int j = 0; j < c; j++) {
    for (int i = 0; i < r; i++) {
      if (IsvalidCol(sol, r, c, j)) {
        if (sol[i][j] == 1) {
          count++;
        }
      }
    }
  }
  cout << count;
  return 0;
}
