#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-12;
string grid[1005];
bool visit[2][1005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    int row, col;
    cin >> row >> col;
    for (int i = 0; i < row; i++) {
      cin >> grid[i];
    }
    long long totRow = 0, ans = 0;
    for (int i = 0; i < row; i++) {
      for (int j = 0; j < col; j++) {
        if (grid[i][j] != '.') {
          visit[0][i] = 1;
          visit[1][j] = 1;
        }
      }
    }
    for (int i = 0; i < row; i++) {
      if (visit[0][i] == 0) {
        totRow++;
        ans += col;
      }
    }
    for (int i = 0; i < col; i++) {
      if (visit[1][i] == 0) {
        ans += row - totRow;
      }
    }
    cout << ans << "\n";
  }
}
