#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, m;
char c[3005][3005];
int cl[3005][3005];
int cr[3005][3005];
bool vis[3005][3005];
long long ans;
struct BIT {
  int val[7010];
  int n;
  void clear(int nn) {
    n = nn;
    fill(val, val + n + 5, 0);
  }
  void change(int pos, int v) {
    pos++;
    while (pos <= n) {
      val[pos] += v;
      pos += pos & (-pos);
    }
  }
  int query(int x) {
    x++;
    if (x == 0) {
      return 0;
    }
    int sum = 0;
    while (x) {
      sum += val[x];
      x -= x & (-x);
    }
    return sum;
  }
  int query(int l, int r) { return query(r) - query(l - 1); }
};
int vl[7005], vr[7005];
int vlc;
BIT bit;
pair<int, int> pos[7005];
long long solve(int x, int y) {
  vlc = 0;
  int xx = x, yy = y;
  while (xx < n && yy >= 0) {
    vl[vlc] = cl[xx][yy];
    vr[vlc] = cr[xx][yy];
    pos[vlc] = make_pair(xx, yy);
    vlc++;
    vis[xx][yy] = true;
    xx++;
    yy--;
  }
  bit.clear(2 * max(n, m) + 5);
  priority_queue<pair<int, int> > delQ;
  long long ans = 0;
  for (int i = vlc - 1; i >= 0; i--) {
    while (true) {
      if (delQ.empty()) {
        break;
      }
      pair<int, int> top = delQ.top();
      if (top.first >= i) {
        delQ.pop();
        bit.change(top.second, -1);
      } else {
        break;
      }
    }
    if (c[pos[i].first][pos[i].second] == '.') {
      while (true) {
        if (delQ.empty()) {
          break;
        }
        pair<int, int> top = delQ.top();
        delQ.pop();
        bit.change(top.second, -1);
      }
    }
    bit.change(i, 1);
    delQ.push(make_pair(i - vr[i], i));
    ans += bit.query(i, i + vl[i] - 1);
  }
  return ans;
}
int main(int argc, char* argv[]) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  for (int i = 0; i < n; i++) {
    cl[i][0] = (c[i][0] == 'z');
    for (int j = 1; j < m; j++) {
      if (c[i][j] == '.') {
        cl[i][j] = 0;
      } else {
        cl[i][j] = cl[i][j - 1] + 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cr[i][m - 1] = (c[i][m - 1] == 'z');
    for (int j = m - 2; j >= 0; j--) {
      if (c[i][j] == '.') {
        cr[i][j] = 0;
      } else {
        cr[i][j] = cr[i][j + 1] + 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!vis[i][j]) {
        ans += solve(i, j);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
