#include <bits/stdc++.h>
const int maxSize = 3000;
class FenwickTree {
 private:
  int data[maxSize];
  int size;

 public:
  FenwickTree();
  void setSize(int n) { size = n; };
  void increase(int row);
  int sum(int tillRow);
  int sum(int fromRow, int toRow);
};
bool table[maxSize][maxSize];
int leftDown[maxSize][maxSize];
int left[maxSize];
FenwickTree fTrees[2 * maxSize];
int main() {
  int n, m;
  long long answer = 0;
  scanf("%d%d\n", &n, &m);
  char s[maxSize + 1];
  std::string str;
  for (int i = 0; i < n + m; i++) fTrees[i].setSize(n);
  for (int i = 0; i < n; i++) {
    std::cin >> str;
    for (int j = 0; j < m; j++) table[i][j] = (str[j] == 'z');
  }
  for (int i = 0; i < n; i++) leftDown[i][0] = (table[i][0] ? 1 : 0);
  for (int j = 0; j < m; j++) leftDown[n - 1][j] = (table[n - 1][j] ? 1 : 0);
  for (int j = 1; j < m; j++)
    for (int i = 0; i < n - 1; i++) {
      leftDown[i][j] = (table[i][j] ? leftDown[i + 1][j - 1] + 1 : 0);
    }
  for (int i = 0; i < n; i++) left[i] = 0;
  int j;
  for (int col = m - 1; col >= 0; col--) {
    for (int row = 0; row < n; row++) {
      if (left[row] > 0) left[row]--;
      if ((left[row] == 0) && table[row][col]) {
        left[row] = 0;
        j = col;
        while (j >= 0 && table[row][j]) {
          left[row]++;
          fTrees[row + j].increase(row);
          j--;
        }
      }
    }
    for (int row = 0; row < n; row++) {
      answer += fTrees[row + col].sum(
          row, row + std::min(left[row], leftDown[row][col]) - 1);
    }
  }
  printf("%I64d\n", answer);
}
FenwickTree::FenwickTree() {
  for (int i = 0; i < maxSize; i++) data[i] = 0;
}
void FenwickTree::increase(int row) {
  while (row < size) {
    data[row]++;
    row = (row | (row + 1));
  }
}
int FenwickTree::sum(int row) {
  int sum = 0;
  while (row >= 0) {
    sum += data[row];
    row -= (((row + 1) ^ row) + 1) >> 1;
  }
  return sum;
}
int FenwickTree::sum(int fromRow, int tillRow) {
  return sum(tillRow) - sum(fromRow - 1);
}
