#include <bits/stdc++.h>
using namespace std;
long n, m, ar[1 << 11][1 << 11];
string st;
long er;
long long ans;
long dp[1 << 11][1 << 11][3];
long mem[1 << 11][1 << 11];
long s1[1 << 11][1 << 11];
long s2[1 << 11][1 << 11];
void rotate() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) mem[i][j] = ar[i][j];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) ar[i][j] = mem[n - j + 1][i];
  swap(n, m);
}
void show() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << ar[i][j];
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    for (int j = 1; j <= m; j++) {
      if (st[j - 1] == '.')
        ar[i][j] = 0;
      else
        ar[i][j] = 1;
    }
  }
  for (int i = 2; i < n; i++) {
    er = 0;
    for (int j = 1; j <= m; j++) er += ar[i][j];
    if (er == 0) ans++;
  }
  for (int j = 2; j < m; j++) {
    er = 0;
    for (int i = 1; i <= n; i++) er += ar[i][j];
    if (er == 0) ans++;
  }
  for (int iter = 1; iter <= 4; iter++) {
    for (int i = 1; i <= max(n, m) + 1; i++) {
      for (int j = 1; j <= max(n, m) + 1; j++) dp[i][j][0] = dp[i][j][1] = 0;
    }
    for (int i = 2; i < n; i++) dp[i][1][0] = 1 - ar[i][1];
    for (int i = 1; i <= n; i++) {
      for (int j = 2; j <= m; j++) {
        if (ar[i][j]) continue;
        dp[i][j][0] += dp[i][j - 1][0];
        dp[i][j][1] += dp[i - 1][j][1] + dp[i - 1][j][0];
      }
    }
    for (int j = 2; j < m; j++) ans += dp[n][j][1];
    rotate();
  }
  long long tans = 0;
  for (int iter = 1; iter <= 4; iter++) {
    for (int i = 1; i <= max(n, m) + 1; i++) {
      for (int j = 1; j <= max(n, m) + 1; j++)
        dp[i][j][0] = dp[i][j][1] = dp[i][j][2] = 0;
    }
    for (int i = 2; i < n; i++) dp[i][1][0] = 1 - ar[i][1];
    for (int i = 2; i < n; i++) {
      for (int j = 2; j <= m; j++) {
        if (ar[i][j]) continue;
        dp[i][j][0] += dp[i][j - 1][0];
        if (j < m) dp[i][j][1] += dp[i - 1][j][1] + dp[i - 1][j][0];
        dp[i][j][2] += dp[i][j - 1][1] + dp[i][j - 1][2];
      }
    }
    for (int i = 2; i < n; i++) tans += dp[i][m][2];
    rotate();
  }
  ans += tans / 2;
  tans = 0;
  for (int iter = 1; iter <= 4; iter++) {
    for (int i = 1; i <= max(n, m) + 1; i++) {
      for (int j = 1; j <= max(n, m) + 1; j++)
        dp[i][j][0] = dp[i][j][1] = dp[i][j][2] = 0;
    }
    for (int i = 2; i < n; i++) dp[i][1][0] = 1 - ar[i][1];
    for (int j = 2; j <= m; j++)
      for (int i = n - 1; i + 1; i--) {
        {
          if (ar[i][j]) continue;
          dp[i][j][0] += dp[i][j - 1][0];
          if (j < m) dp[i][j][1] += dp[i + 1][j][1] + dp[i + 1][j][0];
          dp[i][j][2] += dp[i][j - 1][1] + dp[i][j - 1][2];
        }
      }
    for (int i = 2; i < n; i++) tans += dp[i][m][2];
    rotate();
  }
  ans += tans / 2;
  for (int iter = 1; iter <= 4; iter++) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        s1[i][j] = s1[i - 1][j] + ar[i][j];
        s2[i][j] = s2[i][j - 1] + ar[i][j];
      }
    for (int i = 1; i <= max(n, m) + 1; i++)
      for (int j = 1; j <= max(n, m) + 1; j++) dp[i][j][0] = dp[i][j][1] = 0;
    for (int i = 2; i < n; i++)
      for (int j = 2; j < m; j++) {
        if (s1[i][j] == 0 && ar[i][j - 1] == 0) ans += dp[i][j - 2][1];
        dp[i][j][1] = dp[i][j - 1][1] + (s1[i][j] == 0);
        if (ar[i][j]) dp[i][j][1] = 0;
      }
    rotate();
  }
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
