#include <bits/stdc++.h>
using namespace std;
const int N = 2202;
const long long P = 1000000007;
char c[N][N];
int a[N][N];
int n, m;
long long A;
void sol() {
  int x = 0, y = 0, z, xx, yy, xxx, yyy;
  for (int i = 2; i < n; i++) {
    x = y = z = xx = yy = xxx = yyy = 0;
    for (int j = 2; j < m; j++)
      if (c[i][j] == '.') {
        if (a[i][j] & (1 << 0)) x++, A += xxx;
        if (a[i][j] & (1 << 2)) y++, A += yyy;
        xxx = xx;
        xx = x;
        yyy = yy;
        yy = y;
        if ((a[i][j] & (1 << 0)) && (a[i][j] & (1 << 2))) z++;
      } else {
        A += x * y - z;
        x = y = z = xx = yy = xxx = yyy = 0;
      }
    A += x * y - z;
  }
  for (int j = 2; j < m; j++) {
    x = y = z = xx = yy = xxx = yyy = 0;
    for (int i = 2; i < n; i++)
      if (c[i][j] == '.') {
        if (a[i][j] & (1 << 3)) x++, A += xxx;
        if (a[i][j] & (1 << 1)) y++, A += yyy;
        xxx = xx;
        xx = x;
        yyy = yy;
        yy = y;
        if ((a[i][j] & (1 << 3)) && (a[i][j] & (1 << 1))) z++;
      } else {
        A += x * y - z;
        x = y = z = xx = yy = xxx = yyy = 0;
      }
    A += x * y - z;
  }
  for (int i = 2; i < n; i++)
    if (a[i][1] & (1 << 3)) A++;
  for (int i = 2; i < m; i++)
    if (a[1][i] & (1 << 2)) A++;
  for (int i = 2; i < n; i++)
    for (int j = 2; j < m; j++) {
      if ((a[i][j] & 3) == 3) A++;
      if ((a[i][j] & 6) == 6) A++;
      if ((a[i][j] & 12) == 12) A++;
      if ((a[i][j] & 9) == 9) A++;
    }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", c[i] + 1);
  for (int i = 1; i <= n; i++) a[i][0] = (1 << 1), a[i][m + 1] = (1 << 3);
  for (int i = 1; i <= m; i++) a[0][i] = (1 << 0), a[n + 1][i] = (1 << 2);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (c[i][j] == '.') {
        if (a[i - 1][j] & (1 << 0)) a[i][j] |= (1 << 0);
        if (a[i][j - 1] & (1 << 1)) a[i][j] |= (1 << 1);
      }
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      if (c[i][j] == '.') {
        if (a[i + 1][j] & (1 << 2)) a[i][j] |= (1 << 2);
        if (a[i][j + 1] & (1 << 3)) a[i][j] |= (1 << 3);
      }
  sol();
  cout << A << endl;
  return 0;
}
