#include <bits/stdc++.h>
char str[2005];
int a[2005][2005], b[2005][2005], row[2005][2005], col[2005][2005];
int n, m;
void doit() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    for (int j = 1; j <= m; j++)
      if (str[j - 1] == '.') a[i][j] = 1;
  }
  for (int i = 1; i <= n; ++i) b[i][1] = b[i][m] = 1;
  for (int i = 1; i <= m; ++i) b[1][i] = b[n][i] = 1;
  for (int i = 1; i <= n; i++) {
    row[i][0] = 0;
    for (int j = 1; j <= m; j++) row[i][j] = row[i][j - 1] + a[i][j];
  }
  for (int i = 1; i <= m; i++) {
    col[i][0] = 0;
    for (int j = 1; j <= n; j++) col[i][j] = col[i][j - 1] + a[j][i];
  }
  long long ans = 0, p;
  int jj;
  for (int i = 2; i < m; i++)
    if (col[i][n] == n) ans++;
  for (int i = 2; i < n; i++)
    if (row[i][m] == m) ans++;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (a[i][j] && !b[i][j]) {
        if (col[j][i] == i && row[i][j] == j) ans++;
        if (col[j][i] == i && row[i][m] - row[i][j] == m - j) ans++;
        if (col[j][n] - col[j][i] == n - i && row[i][j] == j) ans++;
        if (col[j][n] - col[j][i] == n - i && row[i][m] - row[i][j] == m - j)
          ans++;
      }
  for (int i = 2; i <= n - 1; ++i) {
    for (int j = 2; j < m; j++) {
      if (!a[i][j]) continue;
      jj = j;
      p = 0;
      while (a[i][j + 1]) j++;
      if (j == m) j--;
      for (int k = jj; k <= j; k++) {
        if (col[k][i] == i) p++;
        if (k < j && col[k][i] == i && col[k + 1][i] == i) ans--;
        if (col[k][n] - col[k][i] == n - i) p++;
        if (k < j && col[k][n] - col[k][i] == n - i &&
            col[k + 1][n] - col[k + 1][i] == n - i)
          ans--;
        if (col[k][i] == i && col[k][n] - col[k][i] == n - i) ans--;
      }
      ans += p * (p - 1) / 2;
    }
  }
  for (int i = 2; i <= m - 1; ++i) {
    for (int j = 2; j < n; j++) {
      if (!a[j][i]) continue;
      jj = j;
      p = 0;
      while (a[j + 1][i]) j++;
      if (j == n) j--;
      for (int k = jj; k <= j; k++) {
        if (row[k][i] == i) p++;
        if (k < j && row[k][i] == i && row[k + 1][i] == i) ans--;
        if (row[k][m] - row[k][i] == m - i) p++;
        if (k < j && row[k][m] - row[k][i] == m - i &&
            row[k + 1][m] - row[k + 1][i] == m - i)
          ans--;
        if (row[k][i] == i && row[k][m] - row[k][i] == m - i) ans--;
      }
      ans += p * (p - 1) / 2;
    }
  }
  printf("%I64d\n", ans);
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) doit();
}
