#include <bits/stdc++.h>
using namespace std;
int sum[2010][2010], sum2[2010][2010];
long long D[3][2][2010][2010], n, m, sol;
char s[2010][2010], a[2010][2010];
void goU() {
  for (int j = 2; j <= m - 1; ++j)
    for (int i = 2; i <= n - 1; ++i) {
      int cur = 0;
      if (s[i][j] == '#') continue;
      while (s[i][j] == '.' && i < n) {
        if (!sum2[i][j]) ++cur;
        if (!sum2[i][j] && !sum2[i - 1][j] && i > 2) --sol;
        ++i;
      }
      sol += cur * (cur - 1) / 2;
    }
}
void uldr() {
  memset(D, 0, sizeof(D));
  for (int i = 2; i <= m - 1; ++i)
    if (s[1][i] == '.') D[0][1][1][i] = 1;
  for (int i = 2; i <= n; ++i)
    for (int j = 2; j <= m - 1; ++j)
      if (s[i][j] == '.')
        for (int tr = 0; tr <= 2; ++tr) {
          D[tr][1][i][j] = D[tr][1][i - 1][j];
          if (tr) D[tr][1][i][j] += D[tr - 1][0][i - 1][j];
          if (i == n) continue;
          D[tr][0][i][j] = D[tr][0][i][j - 1];
          if (tr) D[tr][0][i][j] += D[tr - 1][1][i][j - 1];
        }
  for (int i = 2; i <= m - 1; ++i) sol += D[2][1][n][i];
}
void ul() {
  for (int i = 2; i <= n - 1; ++i)
    for (int j = 2; j <= m - 1; ++j)
      if (!sum[i][j] && !sum2[i][j]) sol++;
}
void rotate() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) a[i][j] = s[i][j];
  int li = 1;
  int co = 0;
  for (int i = 1; i <= m; ++i)
    for (int j = n; j >= 1; --j) {
      ++co;
      if (co == n + 1) {
        co = 1;
        ++li;
      }
      s[li][co] = a[j][i];
    }
  swap(n, m);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum[i][j] = sum[i - 1][j] + (s[i][j] == '#');
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum2[i][j] = sum2[i][j - 1] + (s[i][j] == '#');
}
void flip() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m / 2; ++j) swap(s[i][j], s[i][m - j + 1]);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum[i][j] = sum[i - 1][j] + (s[i][j] == '#');
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum2[i][j] = sum2[i][j - 1] + (s[i][j] == '#');
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> (s[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum[i][j] = sum[i - 1][j] + (s[i][j] == '#');
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sum2[i][j] = sum2[i][j - 1] + (s[i][j] == '#');
  for (int i = 2; i <= m - 1; ++i)
    if (!sum[n][i]) sol++;
  for (int i = 2; i <= n - 1; ++i)
    if (!sum2[i][m]) sol++;
  for (int i = 1; i <= 4; ++i) {
    goU();
    if (i >= 3) {
      flip();
      uldr();
      flip();
    } else
      uldr();
    ul();
    rotate();
  }
  cout << sol;
  return 0;
}
