#include <bits/stdc++.h>
using namespace std;
int n, m, h[2005][2005], v[2005][2005], tl;
char s[2005][2005], t[2005][2005];
long long ans;
void go(char s[][2005]) {
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) h[i][j] = h[i][j - 1] + (s[i][j] == '#');
  for (int j = (1); j <= (m); j++)
    for (int i = (1); i <= (n); i++) v[i][j] = v[i - 1][j] + (s[i][j] == '#');
  for (int i = (2); i < (m); i++) ans += !v[n][i];
  for (int i = (2); i < (n); i++)
    for (int j = (2); j < (m); j++) {
      ans += !h[i][j] && !v[i][j];
      ans += h[i][m] == h[i][j - 1] && v[n][j] == v[i - 1][j];
    }
  for (int i = (2); i < (n); i++) {
    tl = 0;
    for (int j = (2); j < (m); j++) {
      if (v[n][j] == v[i - 1][j]) ans += tl;
      if (s[i][j] == '#') tl = 0;
      if (!v[i][j]) tl++;
    }
    tl = 0;
    for (int j = (2); j < (m); j++) {
      if (!v[i][j]) ans += tl;
      if (s[i][j] == '#') tl = 0;
      if (v[n][j] == v[i - 1][j]) tl++;
    }
    tl = 0;
    for (int j = (3); j < (m); j++) {
      if (v[n][j] == v[i - 1][j]) ans += tl;
      if (v[n][j - 1] == v[i - 1][j - 1]) tl++;
      if (s[i][j] == '#') tl = 0;
    }
    tl = 0;
    for (int j = (3); j < (m); j++) {
      if (!v[i][j]) ans += tl;
      if (!v[i][j - 1]) tl++;
      if (s[i][j] == '#') tl = 0;
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (1); i <= (n); i++) scanf("%s", s[i] + 1);
  go(s);
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) t[m + 1 - j][i] = s[i][j];
  swap(n, m);
  go(t);
  printf("%I64d\n", ans);
}
