You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3 × 4 cake may look as follows:

<image>

The cakeminator is going to eat the cake! Each time he eats, he chooses a row or a column that does not contain any evil strawberries and contains at least one cake cell that has not been eaten before, and eats all the cake cells there. He may decide to eat any number of times.

Please output the maximum number of cake cells that the cakeminator can eat.

Input

The first line contains two integers r and c (2 ≤ r, c ≤ 10), denoting the number of rows and the number of columns of the cake. The next r lines each contains c characters — the j-th character of the i-th line denotes the content of the cell at row i and column j, and is either one of these: 

  * '.' character denotes a cake cell with no evil strawberry; 
  * 'S' character denotes a cake cell with an evil strawberry. 

Output

Output the maximum number of cake cells that the cakeminator can eat.

Examples

Input

3 4
S...
....
..S.


Output

8

Note

For the first example, one possible way to eat the maximum number of cake cells is as follows (perform 3 eats).

<image> <image> <image>
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long long MOD1 = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.1415926535897932384626;
const long long MAX_SIZE = 2e6 + 6;
const long long MAX = INT_MAX;
const long long MIN = INT_MIN;
bool prime[MAX_SIZE];
void Sieve_Of_Eratosthenes() {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i <= MAX_SIZE; i++) {
    if (prime[i] == true) {
      for (long long j = i * i; j <= MAX_SIZE; j += i) prime[j] = false;
    }
  }
}
long long powerM(long long x, long long y, long long M = MOD1) {
  long long v = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) v = (v * x) % M;
    y = y >> 1;
    x = (x * x) % M;
  }
  return v;
}
long long power(long long x, long long y) {
  long long v = 1;
  while (y > 0) {
    if (y & 1) v = v * x;
    y = y >> 1;
    x = x * x;
  }
  return v;
}
bool Is_Power_Of_Two(long long x) { return x && (!(x & (x - 1))); }
string Print_LCS(string x, string y) {
  long long n = x.length(), m = y.length(), dp[n + 1][m + 1], i, j;
  memset(dp, 0, sizeof(dp));
  for (i = 1; i < n + 1; i++) {
    for (j = 1; j < m + 1; j++) {
      if (x[i - 1] == y[j - 1])
        dp[i][j] = 1 + dp[i - 1][j - 1];
      else
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }
  string str = "";
  i = n, j = m;
  while (i > 0 && j > 0) {
    if (x[i - 1] == y[j - 1])
      str += x[i - 1], i--, j--;
    else
      dp[i - 1][j] > dp[i][j - 1] ? i-- : j--;
  }
  reverse(str.begin(), str.end());
  return str;
}
bool Compare(pair<long long, pair<long long, long long>> A,
             pair<long long, pair<long long, long long>> B) {
  return A.second.second > B.second.second;
}
void Solve() {
  long long r, c, i, j;
  cin >> r >> c;
  char cake[r][c];
  for (i = 0; i < r; i++)
    for (j = 0; j < c; j++) cin >> cake[i][j];
  for (i = 0; i < r; i++) {
    bool ok = true;
    for (j = 0; j < c; j++) {
      if (cake[i][j] == 'S') {
        ok = false;
        break;
      }
    }
    if (ok) {
      for (j = 0; j < c; j++) cake[i][j] = 'E';
    }
  }
  for (i = 0; i < c; i++) {
    bool ok = true;
    for (j = 0; j < r; j++) {
      if (cake[j][i] == 'S') {
        ok = false;
        break;
      }
    }
    if (ok) {
      for (j = 0; j < r; j++) cake[j][i] = 'E';
    }
  }
  long long cnt = 0;
  for (i = 0; i < r; i++)
    for (j = 0; j < c; j++)
      if (cake[i][j] == 'E') cnt++;
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  Solve();
}
