#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, m;
char as[2005][2005];
int a[2005][2005];
int b[4][2005][2005];
long long dab;
int it[10000];
int S;
void update(int x) {
  x /= 2;
  while (x > 0) it[x] = it[x * 2] + it[x * 2 + 1], x /= 2;
}
int getsum(int x, int y) {
  int sum = 0;
  while (x <= y) {
    if (x % 2 == 1) sum += it[x++];
    if (y % 2 == 0) sum += it[y--];
    x /= 2, y /= 2;
  }
  return sum;
}
void calc(int one = 1) {
  int i, j, k;
  for (i = 0; i < n; i++) b[2][i][0] = a[i][0], b[3][i][m - 1] = a[i][m - 1];
  for (i = 0; i < m; i++) b[0][0][i] = a[0][i], b[1][n - 1][i] = a[n - 1][i];
  for (i = 1; i < n; i++)
    for (j = 0; j < m; j++) b[0][i][j] = b[0][i - 1][j] + a[i][j];
  for (i = n - 2; i >= 0; i--)
    for (j = 0; j < m; j++) b[1][i][j] = b[1][i + 1][j] + a[i][j];
  for (i = 1; i < m; i++)
    for (j = 0; j < n; j++) b[2][j][i] = b[2][j][i - 1] + a[j][i];
  for (i = m - 2; i >= 0; i--)
    for (j = 0; j < n; j++) b[3][j][i] = b[3][j][i + 1] + a[j][i];
  if (one)
    for (i = 1; i < m - 1; i++) dab += !b[0][n - 1][i];
  if (one)
    for (i = 1; i < n - 1; i++) dab += !b[2][i][m - 1];
  if (one)
    for (i = 1; i < n - 1; i++)
      for (j = 1; j < m - 1; j++)
        dab += !b[0][i][j] * !b[2][i][j] + !b[2][i][j] * !b[1][i][j] +
               !b[1][i][j] * !b[3][i][j] + !b[3][i][j] * !b[0][i][j];
  for (S = 1; S < m; S *= 2)
    ;
  for (i = 1; i < m - 1; i++) it[S + i] = !a[0][i], update(S + i);
  for (i = 1; i < n - 1; i++) {
    for (j = 1; j < m - 1; j++) it[S + j] &= !a[i][j], update(S + j);
    for (j = 1; j < m - 2; j++) {
      if (a[i][j]) continue;
      int low = j + 1, high = m - 2, mid;
      while (low <= high) {
        mid = (low + high) / 2;
        if (b[2][i][j] != b[2][i][mid])
          high = mid - 1;
        else
          low = mid + 1;
      }
      dab += (long long)(!b[0][i][j]) * getsum(S + j + 2, S + high) +
             (!b[1][i][j]) * getsum(S + j + 1, S + high);
    }
  }
}
int main() {
  int i, j, k;
  cin >> n >> m;
  for (i = 0; i < n; i++) scanf("%s", as[i]);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) a[i][j] = as[i][j] == '.' ? 0 : 1;
  calc();
  for (i = 0; i < n / 2; i++)
    for (j = 0; j < m; j++) swap(a[i][j], a[n - 1 - i][j]);
  calc(0);
  for (i = 0; i < max(n, m); i++)
    for (j = 0; j < i; j++) swap(a[i][j], a[j][i]);
  swap(n, m);
  calc(0);
  for (i = 0; i < n / 2; i++)
    for (j = 0; j < m; j++) swap(a[i][j], a[n - 1 - i][j]);
  calc(0);
  cout << dab;
  return 0;
}
