#include <bits/stdc++.h>
using namespace std;
const int maxn = 2050;
int a[maxn][maxn], b[maxn][maxn];
int l[maxn][maxn], r[maxn][maxn];
int f[maxn][maxn], g[maxn][maxn];
int u[maxn][maxn], d[maxn][maxn];
char str[maxn][maxn];
int n, m;
int ans0, ans1;
long long ans2;
int get(char ch) {
  if (ch == '.') return 0;
  return 1;
}
void Rot() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) b[m - j + 1][i] = a[i][j];
  swap(n, m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) a[i][j] = b[i][j];
}
void Work() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      f[i][j] = f[i][j - 1] + a[i][j], g[i][j] = g[i - 1][j] + a[i][j];
  for (int i = 1; i <= n; i++) {
    l[i][0] = 0;
    for (int j = 1; j <= m; j++)
      if (a[i][j])
        l[i][j] = j;
      else
        l[i][j] = l[i][j - 1];
    r[i][m + 1] = m + 1;
    for (int j = m; j >= 1; j--)
      if (a[i][j])
        r[i][j] = j;
      else
        r[i][j] = r[i][j + 1];
  }
  for (int i = 1; i <= n; i++) {
    u[i][1] = 0;
    for (int j = 2; j < m; j++)
      if (g[i][j] == 0)
        u[i][j] = u[i][j - 1] + 1;
      else
        u[i][j] = u[i][j - 1];
    d[i][1] = 0;
    for (int j = 2; j < m; j++)
      if (g[n][j] == g[i - 1][j])
        d[i][j] = d[i][j - 1] + 1;
      else
        d[i][j] = d[i][j - 1];
    u[i][m] = u[i][m - 1];
    d[i][m] = d[i][m - 1];
  }
  for (int i = 2; i < n; i++)
    for (int j = 2; j < m; j++) {
      if (g[i][j]) continue;
      if (j - 2 > l[i][j]) ans2 += u[i][j - 2] - u[i][l[i][j]];
      if (j - 1 > l[i][j]) ans2 += d[i][j - 1] - d[i][l[i][j]];
      if (r[i][j] - 1 > j + 1) ans2 += u[i][r[i][j] - 1] - u[i][j + 1];
      if (r[i][j] - 1 > j) ans2 += d[i][r[i][j] - 1] - d[i][j];
    }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", str[i] + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      a[i][j] = get(str[i][j]);
      f[i][j] = f[i][j - 1] + a[i][j];
      g[i][j] = g[i - 1][j] + a[i][j];
    }
  }
  for (int i = 2; i < n; i++)
    if (f[i][m] == 0) ++ans0;
  for (int i = 2; i < m; i++)
    if (g[n][i] == 0) ++ans0;
  for (int i = 2; i < n; i++)
    for (int j = 2; j < m; j++) {
      if (a[i][j]) continue;
      int cnt1 = f[i][j], cnt2 = g[i][j], cnt3 = f[i][m] - f[i][j],
          cnt4 = g[n][j] - g[i][j];
      ans1 += 4;
      if (cnt1 + cnt2) ans1--;
      if (cnt2 + cnt3) ans1--;
      if (cnt3 + cnt4) ans1--;
      if (cnt1 + cnt4) ans1--;
    }
  for (int beta = 1; beta <= 4; ++beta) Work(), Rot();
  ans2 /= 2;
  ans2 += ans0 + ans1;
  printf("%I64d\n", ans2);
  return 0;
}
