#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0l);
const long long MOD = 1e9 + 7;
bool debug = 1;
const int N = 3e3 + 10;
int seg[2 * N];
int n, m;
void build() {
  for (int i = n - 1; i > 0; i--) seg[i] = seg[i << 1] + seg[i << 1 | 1];
}
int qry(int l, int r) {
  int ans = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) ans += seg[l++];
    if (r & 1) ans += seg[--r];
  }
  return ans;
}
void up(int pos, int x) {
  for (seg[pos += n] = x; pos > 1; pos >>= 1) {
    seg[pos >> 1] = seg[pos] + seg[pos ^ 1];
  }
}
char mat[N][N];
int dpesq[N][N], dpdir[N][N], dpdia[N][N];
bool ok(int i, int j) { return i >= 0 and i < n and j >= 0 and j < m; }
vector<int> ev[N];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf(" %c", mat[i] + j);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int ant = 0;
      if (j) ant = dpesq[i][j - 1];
      if (mat[i][j] == 'z') dpesq[i][j] = ant + 1;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = m - 1; j >= 0; j--) {
      int ant = 0;
      if (j < m - 1) ant = dpdir[i][j + 1];
      if (mat[i][j] == 'z') dpdir[i][j] = ant + 1;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      int ant = 0;
      if (ok(i + 1, j - 1)) ant = dpdia[i + 1][j - 1];
      if (mat[i][j] == 'z') dpdia[i][j] = ant + 1;
    }
  }
  long long ans = 0;
  for (int inic = 0; inic < n; inic++) {
    int i = inic, j = 0;
    memset(seg, 0, sizeof(seg));
    for (int jj = 0; jj < m; jj++) ev[jj].clear();
    while (ok(i, j)) {
      for (auto it : ev[j]) {
        up(it, 0);
      }
      if (mat[i][j] == 'z') {
        up(j, 1);
        ev[j + dpdir[i][j]].push_back(j);
        int mind = min(dpesq[i][j], dpdia[i][j]);
        ans += qry(j - mind + 1, j + 1);
      }
      i--, j++;
    }
  }
  for (int inicj = 1; inicj <= m - 1; inicj++) {
    int i = n - 1, j = inicj;
    memset(seg, 0, sizeof(seg));
    for (int jj = 0; jj < m; jj++) ev[jj].clear();
    while (ok(i, j)) {
      for (auto it : ev[j]) {
        up(it, 0);
      }
      if (mat[i][j] == 'z') {
        up(j, 1);
        ev[j + dpdir[i][j]].push_back(j);
        int mind = min(dpesq[i][j], dpdia[i][j]);
        ans += qry(j - mind + 1, j + 1);
      }
      i--, j++;
    }
  }
  cout << ans << endl;
  return 0;
}
