#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
char mp[N][N];
int L[N][N], R[N][N], U[N][N], D[N][N];
int r1[N][N], r2[N][N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1);
  for (int i = 1; i <= n; ++i) {
    R[i][m + 1] = m + 1;
    for (int j = m; j >= 1; --j) {
      R[i][j] = mp[i][j] == '#' ? j : R[i][j + 1];
    }
    for (int j = 1; j <= m; ++j) {
      L[i][j] = mp[i][j] == '#' ? j : L[i][j - 1];
    }
  }
  for (int j = 1; j <= m; ++j) {
    for (int i = 1; i <= n; ++i) {
      U[i][j] = mp[i][j] == '#' ? i : U[i - 1][j];
    }
    D[n + 1][j] = n + 1;
    for (int i = n; i >= 1; --i) {
      D[i][j] = mp[i][j] == '#' ? i : D[i + 1][j];
    }
  }
  long long ans = 0;
  for (int i = 2; i < n; ++i) ans += R[i][1] == m + 1;
  for (int j = 2; j < m; ++j) ans += D[1][j] == n + 1;
  for (int j = 2; j < m; ++j) {
    for (int i = 2; i < n && i < D[1][j]; ++i) {
      ans += L[i][j] == 0;
      ans += R[i][j] == m + 1;
    }
    for (int i = n - 1; i > 1 && i > U[n][j]; --i) {
      ans += L[i][j] == 0;
      ans += R[i][j] == m + 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      r1[i][j] = r1[i][j - 1] + (U[i][j] == 0);
      r2[i][j] = r2[i][j - 1] + (D[i][j] == n + 1);
    }
  }
  for (int j = 3; j < m; ++j) {
    for (int i = 2; i < n && i < D[1][j]; ++i) {
      int l = max(1, L[i][j]);
      ans += max(0, r1[i][j - 2] - r1[i][l]);
      ans += max(0, r2[i][j - 1] - r2[i][l]);
    }
    for (int i = n - 1; i > 1 && i > U[n][j]; --i) {
      int l = max(1, L[i][j]);
      ans += max(0, r1[i][j - 1] - r1[i][l]);
      ans += max(0, r2[i][j - 2] - r2[i][l]);
    }
  }
  for (int j = 1; j <= m; ++j) {
    for (int i = 1; i <= n; ++i) {
      r1[i][j] = r1[i - 1][j] + (L[i][j] == 0);
      r2[i][j] = r2[i - 1][j] + (R[i][j] == m + 1);
    }
  }
  for (int i = 3; i < n; ++i) {
    for (int j = 2; j < m && j < R[i][1]; ++j) {
      int l = max(1, U[i][j]);
      ans += max(0, r1[i - 2][j] - r1[l][j]);
      ans += max(0, r2[i - 1][j] - r2[l][j]);
    }
    for (int j = m - 1; j > 1 && j > L[i][m]; --j) {
      int l = max(1, U[i][j]);
      ans += max(0, r1[i - 1][j] - r1[l][j]);
      ans += max(0, r2[i - 2][j] - r2[l][j]);
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
