#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
template <class T>
class SegmentTree {
  int maxn = 1000000;
  vector<T> t;
  void build(const vector<T> &a, int v, int tl, int tr) {
    if (tl == tr) {
      t[v] = a[tl];
    } else {
      int tm = (tl + tr) / 2;
      build(a, v * 2 + 1, tl, tm);
      build(a, v * 2 + 2, tm + 1, tr);
      t[v] = t[v * 2 + 1] + t[v * 2 + 2];
    }
  }
  T sum(int v, int tl, int tr, int l, int r) {
    if (l > r) {
      return 0;
    }
    if (l == tl && r == tr) {
      return t[v];
    }
    int tm = (tl + tr) / 2;
    return sum(v * 2 + 1, tl, tm, l, min(r, tm)) +
           sum(v * 2 + 2, tm + 1, tr, max(l, tm + 1), r);
  }
  void update(int v, int tl, int tr, int pos, T new_val) {
    if (tl == tr) {
      t[v] += new_val;
    } else {
      int tm = (tl + tr) / 2;
      if (pos <= tm) {
        update(v * 2 + 1, tl, tm, pos, new_val);
      } else {
        update(v * 2 + 2, tm + 1, tr, pos, new_val);
      }
      t[v] = t[v * 2 + 1] + t[v * 2 + 2];
    }
  }

 public:
  SegmentTree(int n) {
    maxn = n;
    t.resize(4 * maxn);
  }
  SegmentTree(const vector<T> &a) {
    maxn = a.size();
    t.resize(4 * maxn);
    build(a, 0, 0, maxn - 1);
  }
  void update(int pos, T add) { update(0, 0, maxn - 1, pos, add); }
  T sum(int l, int r) { return sum(0, 0, maxn - 1, l, r); }
};
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (int __i = 0; __i < (n); ++__i) cin >> v[__i];
  ;
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j) {
      a[i][j] = v[i][j] == 'z';
    }
  }
  vector<vector<int>> left = a;
  vector<vector<int>> right = a;
  for (int i = (0); i < (n); ++i) {
    for (int j = (1); j < (m); ++j) {
      if (left[i][j] == 0) {
        continue;
      }
      left[i][j] += left[i][j - 1];
    }
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = (m - 2); j > (-1); --j) {
      if (right[i][j] == 0) {
        continue;
      }
      right[i][j] += right[i][j + 1];
    }
  }
  long long res = 0;
  for (int k = (0); k < (n + m - 1); ++k) {
    vector<int> b(n);
    vector<int> c(n);
    SegmentTree<int> t(n);
    vector<int> pre(n, 0);
    for (int i = (0); i < (n); ++i) {
      int j = k - i;
      if (j < 0 || j >= m) {
        continue;
      }
      pre[i] = a[i][j];
      b[i] = left[i][j];
      c[i] = right[i][j];
    }
    for (int i = (1); i < (n); ++i) {
      if (pre[i] == 0) {
        continue;
      }
      pre[i] += pre[i - 1];
    }
    priority_queue<pair<int, int>> pq;
    for (int i = (0); i < (n); ++i) {
      if (b[i] == 0) {
        continue;
      }
      while (pq.size() && -pq.top().first <= i) {
        t.update(pq.top().second, -1);
        pq.pop();
      }
      t.update(i, 1);
      pq.push({-i - b[i], i});
      int pos = max(0, max(i - pre[i] + 1, i - c[i] + 1));
      res += t.sum(pos, i);
    }
  }
  cout << res;
}
