#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000000000000;
const int maxn = 3003;
int fen[maxn * 2][maxn];
char v[maxn][maxn];
int zl[maxn][maxn];
int zr[maxn][maxn];
int zld[maxn][maxn];
void add(int num, int pos, int val) {
  for (; pos < maxn; pos |= pos + 1) fen[num][pos] += val;
}
int rsq(int num, int pos) {
  int res = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) res += fen[num][pos];
  return res;
}
int query(int num, int l, int r) {
  return rsq(num, r) - (l == 0 ? 0 : rsq(num, l - 1));
}
struct str {
  int sum, i, j;
};
tuple<int, int, int> dop[maxn * maxn];
bool cmp(tuple<int, int, int> &l, tuple<int, int, int> &r) {
  return get<0>(l) > get<0>(r);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int c = 0; c < n; c++) {
    for (int i = 0; i < m; i++) cin >> v[c][i];
  }
  for (int c = n - 1; c >= 0; c--) {
    for (int i = 0; i < m; i++) {
      if (v[c][i] != '.') {
        if (i)
          zl[c][i] = zl[c][i - 1] + 1;
        else
          zl[c][i] = 1;
      }
    }
    for (int i = m - 1; i >= 0; i--) {
      if (v[c][i] != '.') {
        if (i == m - 1)
          zr[c][i] = 1;
        else
          zr[c][i] = zr[c][i + 1] + 1;
      }
    }
    for (int i = 0; i < m; i++) {
      if (v[c][i] == 'z') {
        if (i == 0 || c == n - 1)
          zld[c][i] = 1;
        else
          zld[c][i] = zld[c + 1][i - 1] + 1;
      }
    }
  }
  int kol = 0;
  for (int c = 0; c < n; c++) {
    for (int i = 0; i < m; i++) {
      get<0>(dop[kol]) = i + zr[c][i];
      get<1>(dop[kol]) = c;
      get<2>(dop[kol]) = i;
      kol++;
    }
  }
  int l = 0;
  sort(dop, dop + kol, cmp);
  int len = kol;
  long long answ = 0;
  for (int i = m - 1; i >= 0; i--) {
    while (l < len && get<0>(dop[l]) > i) {
      add(get<1>(dop[l]) + get<2>(dop[l]), get<2>(dop[l]), 1);
      l++;
    }
    for (int c = 0; c < n; c++) {
      int mmin = min(zl[c][i], zld[c][i]);
      answ += query(c + i, i - mmin + 1, i);
    }
  }
  cout << answ;
  return 0;
}
