#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int n, m;
char grid[N][N];
int zl[N][N], zr[N][N], zld[N][N];
vector<pair<int, int>> events[N];
int fen[N << 1][N];
int fget(int w, int i) {
  int ret = 0;
  while (i > 0) {
    ret += fen[w][i];
    i -= i & -i;
  }
  return ret;
}
void fadd(int w, int i, int val) {
  while (i < N) {
    fen[w][i] += val;
    i += i & -i;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", grid[i] + 1);
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= m; j++) {
      if (grid[i][j] == '.') {
        zl[i][j] = 0;
        zld[i][j] = 0;
      } else if (grid[i][j] == 'z') {
        zl[i][j] = 1 + zl[i][j - 1];
        zld[i][j] = 1 + zld[i + 1][j - 1];
      } else
        assert(0);
    }
  for (int i = 1; i <= n; i++)
    for (int j = m; j >= 1; j--) {
      if (grid[i][j] == '.') {
        zr[i][j] = 0;
      } else if (grid[i][j] == 'z') {
        zr[i][j] = 1 + zr[i][j + 1];
      } else
        assert(0);
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (zr[i][j]) events[j + zr[i][j] - 1].push_back(make_pair(i, j));
    }
  long long ans = 0;
  for (int j = m; j >= 1; j--) {
    for (auto it : events[j]) {
      int x = it.first;
      int y = it.second;
      fadd(x + y, y, 1);
    }
    for (int i = 1; i <= n; i++) {
      int c = min(zl[i][j], zld[i][j]);
      if (c > 0) ans += fget(i + j, j) - (j - c > 0 ? fget(i + j, j - c) : 0);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
