#include <bits/stdc++.h>
using namespace std;
const int N = 3010;
char s[N][N];
bool vis[N][N];
int lt[N][N], rt[N][N];
int down[N][N];
int cnt;
int sum[N * 24], ls[N * 24], rs[N * 24];
void update(int &x, int y, int l, int r, int pos) {
  x = ++cnt;
  sum[x] = sum[y] + 1;
  ls[x] = ls[y];
  rs[x] = rs[y];
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(ls[x], ls[y], l, mid, pos);
  else
    update(rs[x], rs[y], mid + 1, r, pos);
}
void clear() {
  for (int i = 1; i <= cnt; i++) {
    ls[i] = rs[i] = sum[i] = 0;
  }
  cnt = 0;
}
int query(int x, int y, int l, int r, int kth) {
  if (!x && !y) return 0;
  if (r < kth) return 0;
  if (l >= kth) return sum[y] - sum[x];
  int mid = (l + r) >> 1;
  return query(ls[x], ls[y], l, mid, kth) +
         query(rs[x], rs[y], mid + 1, r, kth);
}
int root[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == 'z') lt[i][j] = lt[i][j - 1] + 1;
  for (int i = 1; i <= n; i++)
    for (int j = m; j >= 1; j--)
      if (s[i][j] == 'z') rt[i][j] = rt[i][j + 1] + 1;
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      if (s[i][j] == 'z') {
        down[i][j] = down[i + 1][j - 1] + 1;
      }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (vis[i][j]) continue;
      for (int k = 0; i + k <= n && j - k >= 1; k++) {
        int x = i + k, y = j - k;
        update(root[k + 1], root[k], 0, m, y + rt[x][y] - 1);
      }
      for (int k = 0; i + k <= n && j - k >= 1; k++) {
        int x = i + k, y = j - k;
        vis[x][y] = true;
        if (!down[x][y] || !lt[x][y]) continue;
        int d = min(down[x][y], lt[x][y]);
        ans += query(root[k], root[k + d], 0, m, y);
      }
      clear();
    }
  cout << ans << endl;
  return 0;
}
