#include <bits/stdc++.h>
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1070000000LL;
const long long MOD = 1000000007LL;
using namespace std;
int n, m;
char c[1 << 11][1 << 11];
char c_[1 << 11][1 << 11];
int a[1 << 11][1 << 11];
int s[1 << 11][1 << 11];
long long ans0, ans1, ans2a, ans2b;
int work[1 << 11];
void solve() {
  for (long long i = (long long)(1); i < (long long)(n - 1); i++) {
    ans0 +=
        (s[i + 1][m - 1 + 1] - s[i + 1][0] - s[i][m - 1 + 1] + s[i][0]) == 0;
  }
  for (long long i = (long long)(1); i < (long long)(n - 1); i++)
    for (long long j = (long long)(1); j < (long long)(m - 1); j++) {
      ans1 += (s[i + 1][j + 1] - s[i + 1][j] - s[0][j + 1] + s[0][j]) +
                  (s[i + 1][j + 1] - s[i + 1][0] - s[i][j + 1] + s[i][0]) ==
              0;
    }
  for (long long j = (long long)(1); j < (long long)(m - 1); j++) {
    int from = -1, to;
    for (long long i = (long long)(1); i < (long long)(n); i++) {
      if (a[i][j] == 0 && from == -1) {
        from = i;
      }
      if ((i == n - 1 || a[i][j] == 1) && from != -1) {
        to = i;
        long long num = 0;
        long long adj = 0;
        for (long long y = (long long)(from); y < (long long)(to); y++) {
          work[y] =
              (s[y + 1][j + 1] - s[y + 1][0] - s[y][j + 1] + s[y][0]) == 0;
          num += work[y];
          if (y > from && work[y - 1] == 1 && work[y] == 1) adj++;
        }
        ans2a += num * (num - 1) / 2 - adj;
        long long numL = 0, numR = 0, both = 0;
        for (long long y = (long long)(from); y < (long long)(to); y++) {
          int okL =
              (s[y + 1][j + 1] - s[y + 1][0] - s[y][j + 1] + s[y][0]) == 0;
          int okR = (s[y + 1][m - 1 + 1] - s[y + 1][j] - s[y][m - 1 + 1] +
                     s[y][j]) == 0;
          numL += okL;
          numR += okR;
          if (okL && okR) both++;
        }
        ans2b += numL * numR - both;
        from = -1;
      }
    }
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> c[i];
  for (long long dir = (long long)(0); dir < (long long)(4); dir++) {
    for (long long i = (long long)(0); i < (long long)(n); i++)
      for (long long j = (long long)(0); j < (long long)(m); j++) {
        a[i][j] = c[i][j] == '#';
        s[i + 1][j + 1] = a[i][j] + s[i + 1][j] + s[i][j + 1] - s[i][j];
      }
    solve();
    for (long long i = (long long)(0); i < (long long)(n); i++)
      for (long long j = (long long)(0); j < (long long)(m); j++) {
        c_[j][n - 1 - i] = c[i][j];
      }
    swap(n, m);
    for (long long i = (long long)(0); i < (long long)(n); i++)
      for (long long j = (long long)(0); j < (long long)(m); j++) {
        c[i][j] = c_[i][j];
      }
  }
  cout << ans0 / 2 + ans1 + ans2a + ans2b / 2 << endl;
}
