#include <bits/stdc++.h>
using namespace std;
int n, m;
int zl[3010][3010];
int zr[3010][3010];
int zld[3010][3010];
char massiv[3010][3010];
int fen[6020][3010];
vector<pair<int, int> > points[3010];
void add(int x, int y) {
  for (; y <= m; y |= (y + 1)) {
    fen[x][y]++;
  }
}
int f(int x, int y) {
  int sum = 0;
  for (; y >= 0; y = (y & (y + 1)) - 1) {
    sum += fen[x][y];
  }
  return sum;
}
int sum(int r, int x, int y) { return f(r, y) - f(r, x - 1); }
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> massiv[i][j];
      if (massiv[i][j] == 'z')
        zl[i][j] = zl[i][j - 1] + 1;
      else
        zl[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 1; j--) {
      if (massiv[i][j] == 'z')
        zr[i][j] = zr[i][j + 1] + 1;
      else
        zr[i][j] = 0;
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= m; j++) {
      if (massiv[i][j] == 'z')
        zld[i][j] = zld[i + 1][j - 1] + 1;
      else
        zld[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (zr[i][j]) points[j + zr[i][j] - 1].push_back(make_pair(i, j));
    }
  }
  long long ans = 0;
  for (int j = m; j >= 1; j--) {
    for (auto p : points[j]) {
      int x = p.first;
      int y = p.second;
      add(x + y, y);
    }
    for (int i = 1; i <= n; i++) {
      int raz = min(zld[i][j], zl[i][j]);
      if (!raz) continue;
      ans += sum(i + j, j - raz + 1, j);
    }
  }
  cout << ans << "\n";
  return 0;
}
