#include <bits/stdc++.h>
using namespace std;
int const maxn = 2005;
char s[maxn][maxn];
int u[maxn][maxn];
int l[maxn][maxn];
int r[maxn][maxn];
int d[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  for (int i = 0; i < (int)(maxn); ++i)
    for (int j = 0; j < (int)(maxn); ++j) {
      u[i][j] = 0;
      d[i][j] = 0;
      l[i][j] = 0;
      r[i][j] = 0;
    }
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < (int)(n); ++i) cin >> s[i];
  for (int i = 1; i < n - 1; ++i) {
    for (int j = 0; j < m && s[i][j] == '.'; ++j) l[i][j] = 1;
    for (int j = m - 1; j >= 0 && s[i][j] == '.'; --j) r[i][j] = 1;
  }
  for (int j = 1; j < m - 1; ++j) {
    for (int i = 0; i < n && s[i][j] == '.'; ++i) u[i][j] = 1;
    for (int i = n - 1; i >= 0 && s[i][j] == '.'; --i) d[i][j] = 1;
  }
  long long ans = 0;
  for (int i = 1; i < n - 1; ++i) ans += r[i][0];
  for (int j = 1; j < m - 1; ++j) ans += d[0][j];
  for (int i = 1; i < n - 1; ++i)
    for (int j = 1; j < m - 1; ++j) {
      ans += (l[i][j] + r[i][j]) * (u[i][j] + d[i][j]);
    }
  for (int i = 1; i < n - 1; ++i) {
    int cur = 0;
    for (int j = 1; j < m - 1; ++j) {
      ans += u[i][j - 1] * d[i][j] + u[i][j] * d[i][j - 1];
      ans += cur * (u[i][j] + d[i][j]);
      cur += u[i][j - 1] + d[i][j - 1];
      if (s[i][j - 1] != '.' || s[i][j] != '.') cur = 0;
    }
  }
  for (int j = 1; j < m - 1; ++j) {
    int cur = 0;
    for (int i = 1; i < n - 1; ++i) {
      ans += l[i - 1][j] * r[i][j] + l[i][j] * r[i - 1][j];
      ans += cur * (l[i][j] + r[i][j]);
      cur += l[i - 1][j] + r[i - 1][j];
      if (s[i - 1][j] != '.' || s[i][j] != '.') cur = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
