#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[2222][2222];
int f[4][2222][2222];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
inline bool ok(int i, int j) {
  return i >= 0 && i < n && j >= 0 && j < m && a[i][j] == '.';
}
int get(int i, int j, int w) {
  if (!ok(i, j)) return 0;
  if (f[w][i][j] != -1) return f[w][i][j];
  return f[w][i][j] = 1 + get(i + dx[w], j + dy[w], w);
}
int main() {
  gets(a[0]);
  sscanf(a[0], "%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%s", a[i]);
  }
  memset(f, -1, sizeof(f));
  for (int w = 0; w < 4; ++w) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        get(i, j, w);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      f[0][i][j] = (f[0][i][j] == i + 1);
      f[1][i][j] = (f[1][i][j] == m - j);
      f[2][i][j] = (f[2][i][j] == n - i);
      f[3][i][j] = (f[3][i][j] == j + 1);
    }
  }
  long long ans = 0;
  for (int i = 1; i < n - 1; ++i) {
    ans += f[1][i][0];
  }
  for (int j = 1; j < m - 1; ++j) {
    ans += f[2][0][j];
  }
  for (int i = 1; i < n - 1; ++i) {
    for (int j = 1; j < m - 1; ++j) {
      for (int w1 = 0; w1 < 4; ++w1) {
        for (int w2 = w1 + 1; w2 < 4; ++w2) {
          if (w1 + 2 != w2) {
            ans += f[w1][i][j] * f[w2][i][j];
          }
        }
      }
    }
  }
  for (int i = 1; i < n - 1; ++i) {
    int was_up = 0;
    int was_dn = 0;
    for (int j = 1; j < m - 1; ++j) {
      if (f[0][i][j]) {
        ans += was_dn;
        if (j > 2) ans += was_up - f[0][i][j - 1];
      }
      if (f[2][i][j]) {
        ans += was_up;
        if (j > 2) ans += was_dn - f[2][i][j - 1];
      }
      if (f[0][i][j]) ++was_up;
      if (f[2][i][j]) ++was_dn;
      if (a[i][j] == '#') was_up = was_dn = 0;
    }
  }
  for (int j = 1; j < m - 1; ++j) {
    int was_lt = 0;
    int was_rt = 0;
    for (int i = 1; i < n - 1; ++i) {
      if (f[1][i][j]) {
        ans += was_lt;
        if (i > 2) ans += was_rt - f[1][i - 1][j];
      }
      if (f[3][i][j]) {
        ans += was_rt;
        if (i > 2) ans += was_lt - f[3][i - 1][j];
      }
      if (f[1][i][j]) ++was_rt;
      if (f[3][i][j]) ++was_lt;
      if (a[i][j] == '#') was_lt = was_rt = 0;
    }
  }
  cout << ans << endl;
}
