#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
int n, m;
int R[N], C[N];
int X[N][N], Y[N][N];
int MN[N], MX[N];
int block[N];
int mnBlock[N][N];
int mxBlock[N][N];
string s;
long long int solve(bool flag) {
  long long int res = 0;
  for (int i = 1; i < m + 1; i++) MN[i] = MX[i] = -1;
  for (int i = 1; i < n + 1; i++) {
    block[i] = X[i][1];
    if (MN[1] == -1 && X[i][1]) MN[1] = i;
    if (X[i][1]) MX[1] = i;
  }
  memset(mnBlock, 0, sizeof(mnBlock));
  memset(mxBlock, 0, sizeof(mxBlock));
  for (int i = 2; i < m; i++) {
    for (int j = 1; j < n + 1; j++) {
      if (X[j][i]) block[j] = i;
      if (MN[i] == -1 && X[j][i]) MN[i] = j;
      if (X[j][i]) MX[i] = j;
    }
    if (MN[i] != -1) mnBlock[MN[i]][i] = 1;
    if (MX[i] != -1) mxBlock[MX[i]][i] = 1;
    for (int j = 1; j < n + 1; j++) {
      mnBlock[j][i] +=
          mnBlock[j - 1][i] + mnBlock[j][i - 1] - mnBlock[j - 1][i - 1];
      mxBlock[j][i] +=
          mxBlock[j - 1][i] + mxBlock[j][i - 1] - mxBlock[j - 1][i - 1];
    }
    for (int j = 2; j < n; j++) {
      if (X[1][i] || X[j][i]) break;
      res += !block[j];
    }
    if (i > 3) {
      for (int j = 2; j < n; j++) {
        if (X[1][i] || X[j][i]) break;
        int last = block[j];
        if (last >= i - 2) continue;
        if (!last) last = 1;
        int cnt = mnBlock[j][i - 2] - mnBlock[j][last];
        res += i - 2 - last - cnt;
      }
    }
    if (i > 2) {
      for (int j = 2; j < n; j++) {
        if (X[1][i] || X[j][i]) break;
        int last = block[j];
        if (last >= i - 1) continue;
        if (!last) last = 1;
        int cnt = mxBlock[n][i - 1] - mxBlock[j - 1][i - 1] -
                  (mxBlock[n][last] - mxBlock[j - 1][last]);
        if (flag) res += i - 1 - last - cnt;
      }
    }
  }
  int aa, bb;
  aa = 1;
  bb = m;
  while (aa < bb) {
    for (int i = 1; i < n + 1; i++) swap(X[i][aa], X[i][bb]);
    aa++;
    bb--;
  }
  for (int i = 1; i < m + 1; i++) MN[i] = MX[i] = -1;
  for (int i = 1; i < n + 1; i++) {
    block[i] = X[i][1];
    if (MN[1] == -1 && X[i][1]) MN[1] = i;
    if (X[i][1]) MX[1] = i;
  }
  memset(mnBlock, 0, sizeof(mnBlock));
  memset(mxBlock, 0, sizeof(mxBlock));
  for (int i = 2; i < m; i++) {
    for (int j = 1; j < n + 1; j++) {
      if (X[j][i]) block[j] = i;
      if (MN[i] == -1 && X[j][i]) MN[i] = j;
      if (X[j][i]) MX[i] = j;
    }
    if (MN[i] != -1) mnBlock[MN[i]][i] = 1;
    if (MX[i] != -1) mxBlock[MX[i]][i] = 1;
    for (int j = 1; j < n + 1; j++) {
      mnBlock[j][i] +=
          mnBlock[j - 1][i] + mnBlock[j][i - 1] - mnBlock[j - 1][i - 1];
      mxBlock[j][i] +=
          mxBlock[j - 1][i] + mxBlock[j][i - 1] - mxBlock[j - 1][i - 1];
    }
    if (i > 2) {
      for (int j = 2; j < n; j++) {
        if (X[1][i] || X[j][i]) break;
        int last = block[j];
        if (last >= i - 1) continue;
        if (!last) last = 1;
        int cnt = mxBlock[n][i - 1] - mxBlock[j - 1][i - 1] -
                  (mxBlock[n][last] - mxBlock[j - 1][last]);
        if (flag) res += i - 1 - last - cnt;
      }
    }
  }
  aa = 1;
  bb = m;
  while (aa < bb) {
    for (int i = 1; i < n + 1; i++) swap(X[i][aa], X[i][bb]);
    aa++;
    bb--;
  }
  return res;
}
void rotate() {
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) {
      Y[j][n + 1 - i] = X[i][j];
    }
  swap(n, m);
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) {
      X[i][j] = Y[i][j];
    }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) {
      X[i + 1][j + 1] = (s[j] == '#');
      R[i + 1] |= X[i + 1][j + 1];
      C[j + 1] |= X[i + 1][j + 1];
    }
  }
  long long int ans = 0;
  for (int i = 2; i < n; i++) ans += !R[i];
  for (int i = 2; i < m; i++) ans += !C[i];
  ans += solve(1);
  rotate();
  ans += solve(1);
  rotate();
  ans += solve(0);
  rotate();
  ans += solve(0);
  cout << ans << endl;
  return 0;
}
