#include <bits/stdc++.h>
using namespace std;
int lson[3010 * 20], rson[3010 * 20], root[3010], sum[3010 * 20], tot;
void insert(int proot, int &now, int l, int r, int po) {
  sum[now = ++tot] = sum[proot] + 1;
  if (l == r) return;
  int mid = l + (r - l) / 2;
  if (po > mid) {
    lson[now] = lson[proot];
    insert(rson[proot], rson[now], mid + 1, r, po);
  } else {
    rson[now] = rson[proot];
    insert(lson[proot], lson[now], l, mid, po);
  }
}
int query(int proot, int now, int l, int r, int val) {
  if (l == r) return sum[now] - sum[proot];
  int mid = l + (r - l) / 2;
  if (val > mid)
    return query(rson[proot], rson[now], mid + 1, r, val);
  else
    return query(lson[proot], lson[now], l, mid, val) + sum[rson[now]] -
           sum[rson[proot]];
}
char mp[3010][3010];
int NE[3010][3010], R[3010][3010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = m; j > 0; j--) {
      if (mp[i][j] != 'z') {
        NE[i][j] = R[i][j] = 0;
      } else {
        R[i][j] = R[i][j + 1] + 1;
        NE[i][j] = NE[i - 1][j + 1] + 1;
      }
    }
  }
  long long ans = 0;
  for (int j = 1; j <= m; j++) {
    tot = 0;
    for (int i = 1; i <= n; i++) {
      int num = min(R[i][j], NE[i][j]);
      insert(root[i - 1], root[i], -3000, 3000, R[i][j] - (n - i));
      int tmp = query(root[i - num], root[i], -3000, 3000, 1 - (n - i));
      ans += tmp;
    }
  }
  cout << ans << endl;
  return 0;
}
