#include <bits/stdc++.h>
using namespace std;
auto fio = (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
template <typename T>
struct Wavelet {
  struct node {
    vector<int> wav;
    node *lft, *rgt;
    int id;
  }* root = NULL;
  const int minVal;
  const int maxVal;
  function<bool(T, int)> op;
  function<void(int, typename vector<T>::iterator,
                typename vector<T>::iterator)>
      fun;
  Wavelet(
      typename vector<T>::iterator b, typename vector<T>::iterator e,
      int minVal, int maxVal,
      function<bool(T, int)> op = [](T x, int md) { return x <= md; },
      function<void(int, typename vector<T>::iterator,
                    typename vector<T>::iterator)>
          fun = [](int, typename vector<T>::iterator,
                   typename vector<T>::iterator) {})
      : minVal(minVal), maxVal(maxVal), op(op), fun(fun) {
    vector<int> vec(b, e);
    root = build(vec.begin(), vec.end(), minVal, maxVal, NULL);
  }
  int id_count = 0;
  node* build(typename vector<T>::iterator b, typename vector<T>::iterator e,
              int lo, int hi, node* p) {
    if (b == e) return NULL;
    auto& [wav, lft, rgt, id] = *(p = p ? p : new node());
    int md = lo + hi >> 1;
    wav.reserve(e - b + 1);
    wav.push_back(0);
    id = id_count++;
    fun(id, b, e);
    for (typename vector<T>::iterator it = b; it != e; ++it) {
      wav.push_back(wav.back() + op(*it, md));
    }
    typename vector<T>::iterator m =
        stable_partition(b, e, [=](int i) { return op(i, md); });
    if (lo != hi) {
      lft = build(b, m, lo, md, lft);
      rgt = build(m, e, md + 1, hi, rgt);
    }
    return p;
  }
  int count(int i, int j, int a, int b, int lo, int hi, node* p) {
    if (!p) return 0;
    auto& [wav, lft, rgt, id] = *p;
    if (b < lo || hi < a) return 0;
    if (a <= lo && hi <= b) return j - i;
    int md = lo + hi >> 1;
    return count(wav[i], wav[j], a, b, lo, md, lft) +
           count(i - wav[i], j - wav[j], a, b, md + 1, hi, rgt);
  }
  void clear(node* p) {
    if (!p) return;
    auto& [wav, lft, rgt, vec] = *p;
    clear(lft);
    clear(rgt);
    delete p;
  }
  void clear() {
    clear(root);
    root = NULL;
  }
  int count(int i, int j, int a, int b) {
    return count(i, j + 1, a, b, minVal, maxVal, root);
  }
};
string s[3030];
int lft[3030][3030];
int rgt[3030][3030];
int32_t main() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0, d = 0; j < m; j++) {
      lft[i][j] = d = (s[i][j] == 'z') ? d + 1 : 0;
    }
    for (int j = m, d = 0; j--;) {
      rgt[i][j] = d = (s[i][j] == 'z') ? d + 1 : 0;
    }
  }
  long long ans = 0;
  auto solve = [&](int x, int y) {
    int k = min(n - x, y + 1);
    vector<int> w(k);
    for (int i = 0, d = 0; x + i < n && y - i >= 0; i++) {
      int l = lft[x + i][y - i];
      d = (s[x + i][y - i] == 'z') ? d + 1 : 0;
      w[i] = l - (k - i - 1);
    }
    auto mnx = minmax_element(w.begin(), w.end());
    Wavelet<int> wav(w.begin(), w.end(), *mnx.first, *mnx.second);
    for (int i = 0, d = 0; x + i < n && y - i >= 0; i++) {
      int r = rgt[x + i][y - i];
      d = (s[x + i][y - i] == 'z') ? d + 1 : 0;
      if (!d) continue;
      ans += wav.count(i - min(d, r) + 1, i, 1 - (k - i - 1), +3030);
    }
    wav.clear();
  };
  for (int i = 0, j = 0; i < n && j < m;) {
    solve(i, j);
    if (j == m - 1)
      i++;
    else
      j++;
  }
  cout << ans << endl;
}
