#include <bits/stdc++.h>
using namespace std;
const int dx4[5] = {0, -1, 0, 1, 0};
const int dy4[5] = {0, 0, 1, 0, -1};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int maxn = 2e3 + 5;
const double PI = acos(-1.0);
const long long mod = 1e9 + 7;
long long po(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  } else {
    return gcd(b % a, a);
  }
}
void YES() {
  puts("YES");
  exit(0);
}
void Yes() {
  puts("Yes");
  exit(0);
}
void NO() {
  puts("NO");
  exit(0);
}
void No() {
  puts("No");
  exit(0);
}
void one() {
  puts("-1");
  exit(0);
}
int n, m;
char val[maxn][maxn];
int up[maxn][maxn], down[maxn][maxn];
int le[maxn][maxn], ri[maxn][maxn];
void solve() {
  scanf("%d", &(n)), scanf("%d", &(m));
  for (int i = 1; i <= n; i++) {
    scanf("%s", val[i] + 1);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (val[i][j] == '#') {
        continue;
      } else {
        up[i][j] = up[i - 1][j] + 1;
        le[i][j] = le[i][j - 1] + 1;
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = m; j >= 1; j--) {
      if (val[i][j] == '#') {
        continue;
      } else {
        down[i][j] = down[i + 1][j] + 1;
        ri[i][j] = ri[i][j + 1] + 1;
      }
    }
  }
  long long res = 0;
  for (int i = 2; i < n; i++) {
    res += (le[i][m] >= m);
  }
  for (int i = 2; i < m; i++) {
    res += (up[n][i] >= n);
  }
  for (int i = 2; i < n; i++) {
    for (int j = 2; j < m; j++) {
      int x = 0;
      int y = 0;
      x += le[i][j] >= j;
      x += ri[i][j] >= (m - j + 1);
      y += up[i][j] >= i;
      y += down[i][j] >= (n - i + 1);
      res += x * y;
    }
  }
  for (int i = 2; i < n; i++) {
    int x1 = 0;
    int x2 = 0;
    for (int j = 2; j < m; j++) {
      if (val[i][j] == '#') {
        x1 = 0;
        x2 = 0;
      } else {
        if (j > 2) {
          x2 += up[i][j - 1] >= i;
        }
        res += x1 * (up[i][j] >= i);
        res += x2 * (down[i][j] >= (n - i + 1));
        if (j > 2) {
          x1 += up[i][j - 1] >= i;
        }
      }
    }
  }
  for (int i = 2; i < n; i++) {
    int x1 = 0;
    int x2 = 0;
    for (int j = 2; j < m; j++) {
      if (val[i][j] == '#') {
        x1 = 0;
        x2 = 0;
      } else {
        if (j > 2) {
          x2 += down[i][j - 1] >= (n - i + 1);
        }
        res += x2 * (up[i][j] >= i);
        res += x1 * (down[i][j] >= (n - i + 1));
        if (j > 2) {
          x1 += down[i][j - 1] >= (n - i + 1);
        }
      }
    }
  }
  for (int i = 2; i < m; i++) {
    int x1 = 0;
    int x2 = 0;
    for (int j = 2; j < n; j++) {
      if (val[j][i] == '#') {
        x1 = 0;
        x2 = 0;
      } else {
        if (j > 2) {
          x2 += le[j - 1][i] >= i;
        }
        res += x2 * (ri[j][i] >= (m - i + 1));
        res += x1 * (le[j][i] >= i);
        if (j > 2) {
          x1 += le[j - 1][i] >= i;
        }
      }
    }
  }
  for (int i = 2; i < m; i++) {
    int x1 = 0;
    int x2 = 0;
    for (int j = 2; j < n; j++) {
      if (val[j][i] == '#') {
        x1 = 0;
        x2 = 0;
      } else {
        if (j > 2) {
          x2 += ri[j - 1][i] >= (m - i + 1);
        }
        res += x1 * (ri[j][i] >= (m - i + 1));
        res += x2 * (le[j][i] >= i);
        if (j > 2) {
          x1 += ri[j - 1][i] >= (m - i + 1);
        }
      }
    }
  }
  printf("%lld\n", res);
}
int main() {
  solve();
  return 0;
}
