#include <bits/stdc++.h>
using namespace std;
inline int par(int x) { return (x - 1) / 2; }
inline int lc(int x) { return x * 2 + 1; }
inline int rc(int x) { return x * 2 + 2; }
const int num_elems = 1 << 12;
const int off = num_elems - 1;
const int segsize = num_elems + off;
struct segtree {
  int arr[segsize];
  void update(int x) {
    arr[x] = arr[lc(x)] + arr[rc(x)];
    if (par(x) != x) update(par(x));
  }
  void add(int pos, int val) {
    arr[off + pos] += val;
    update(par(off + pos));
  }
  int query(int from, int to, int l = 0, int r = off, int x = 0) {
    if (to < l || r < from) return 0;
    if (from <= l && r <= to)
      return arr[x];
    else {
      int m = (l + r) / 2;
      return query(from, to, l, m, lc(x)) + query(from, to, m + 1, r, rc(x));
    }
  }
  void print(int x) {
    cout << "arr ";
    for (int i = (0); i < (x); ++i) {
      cout << arr[off + i];
    }
    cout << endl;
  }
};
int l[3000][3000], r[3000][3000];
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(10);
  int n, m;
  cin >> n >> m;
  bool pattern[n][m];
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j) {
      char c;
      cin >> c;
      pattern[n - 1 - i][j] = (c == 'z');
    }
  }
  for (int i = (0); i < (n); ++i) {
    l[i][0] = pattern[i][0];
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = (1); j < (m); ++j) {
      if (pattern[i][j])
        l[i][j] = l[i][j - 1] + 1;
      else
        l[i][j] = 0;
    }
  }
  for (int i = (0); i < (n); ++i) {
    r[i][m - 1] = pattern[i][m - 1];
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = (m - 1) - 1; j >= (0); --j) {
      if (pattern[i][j])
        r[i][j] = r[i][j + 1] + 1;
      else
        r[i][j] = 0;
    }
  };
  long long result = 0;
  segtree s;
  fill_n(s.arr, segsize, 0);
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      until;
  ;
  for (int x = (0); x < (n); ++x) {
    for (int y = (0); y < (m); ++y) {
      if (x > 0 && y > 0) continue;
      for (int d = 0; d + x < n && d + y < m; ++d) {
        if (!pattern[x + d][y + d]) {
          while (!until.empty()) {
            s.add(until.top().second, -1);
            until.pop();
          }
          continue;
        };
        s.add(d, 1);
        until.push({r[x + d][y + d] + d, d});
        while (until.top().first <= d) {
          s.add(until.top().second, -1);
          until.pop();
        };
        ;
        result += s.query(max(d - l[x + d][y + d] + 1, 0), d);
      }
      while (!until.empty()) {
        s.add(until.top().second, -1);
        until.pop();
      };
    }
  }
  cout << result << endl;
  return 0;
}
