#include <bits/stdc++.h>
using namespace std;
int vis[11][11];
char maps[11][11];
int main() {
  int r, c;
  cin >> r >> c;
  for (int i = 1; i <= r; i++)
    for (int j = 1; j <= c; j++) cin >> maps[i][j];
  for (int i = 1; i <= r; i++) {
    int flag = 1;
    for (int j = 1; j <= c; j++)
      if (maps[i][j] == 'S') {
        flag = 0;
        break;
      }
    if (flag)
      for (int j = 1; j <= c; j++) vis[i][j] = 1;
  }
  for (int i = 1; i <= c; i++) {
    int flag = 1;
    for (int j = 1; j <= r; j++)
      if (maps[j][i] == 'S') {
        flag = 0;
        break;
      }
    if (flag)
      for (int j = 1; j <= r; j++) vis[j][i] = 1;
  }
  int sum = 0;
  for (int i = 1; i <= r; i++)
    for (int j = 1; j <= c; j++)
      if (vis[i][j] == 1) sum++;
  cout << sum;
  return 0;
}
