#include <bits/stdc++.h>
using namespace std;
int N, M;
char a[3001][3001];
int l[3001][3001];
int r[3001][3001];
int dl[3001][3001];
int t[3001];
void clearFT() {
  for (int i = 0; i <= 3001; i++) {
    t[i] = 0;
  }
}
int sum(int i) {
  int sum = 0;
  while (i > 0) sum += t[i], i -= i & -i;
  return sum;
}
void add(int i, int k) {
  while (i <= 3001) t[i] += k, i += i & -i;
}
long long solve_a_diagonal(int row, int col) {
  clearFT();
  long long result = 0;
  vector<pair<int, int> > vlines;
  for (int c = col, ro = row; c > 0 && ro <= N; c--, ro++) {
    if (a[ro][c] == 'z' && r[ro][c] > 1) {
      if (c + r[ro][c] - 1 > col)
        vlines.push_back(make_pair(col, ro));
      else
        vlines.push_back(make_pair(c + r[ro][c] - 1, ro));
    }
  }
  if (!vlines.empty()) sort(vlines.begin(), vlines.end());
  for (int c = col, ro = row; c > 0 && ro <= N; c--, ro++) {
    while (!vlines.empty() && vlines.back().first == c) {
      add(vlines.back().second, 1);
      vlines.pop_back();
    }
    int min_c = (l[ro][c] > dl[ro][c]) ? dl[ro][c] : l[ro][c];
    if (min_c > 1) result += sum(ro + min_c - 1) - sum(ro);
  }
  return result;
}
int main() {
  scanf("%d %d\n", &N, &M);
  for (int i = 1; i <= N; i++) {
    scanf("%s", a[i] + 1);
  }
  for (int i = 1; i <= N; i++) {
    int previous_z_index = -1;
    for (int j = 1; j <= M; j++) {
      if (previous_z_index == -1 && a[i][j] == 'z') {
        previous_z_index = j;
      }
      if (a[i][j] == 'z')
        l[i][j] = j - previous_z_index + 1;
      else {
        l[i][j] = -1;
        previous_z_index = -1;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    int previous_z_index = -1;
    for (int j = M; j > 0; j--) {
      if (previous_z_index == -1 && a[i][j] == 'z') {
        previous_z_index = j;
      }
      if (a[i][j] == 'z')
        r[i][j] = previous_z_index - j + 1;
      else {
        r[i][j] = -1;
        previous_z_index = -1;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    int previous_z_index = -1;
    for (int j = 1, k = i; k > 0 && j <= M; j++, k--) {
      if (previous_z_index == -1 && a[k][j] == 'z') {
        previous_z_index = j;
      }
      if (a[k][j] == 'z')
        dl[k][j] = j - previous_z_index + 1;
      else {
        dl[k][j] = -1;
        previous_z_index = -1;
      }
    }
  }
  for (int i = 1; i <= M; i++) {
    int previous_z_index = -1;
    for (int j = i, k = N; k > 0 && j <= M; j++, k--) {
      if (previous_z_index == -1 && a[k][j] == 'z') {
        previous_z_index = j;
      }
      if (a[k][j] == 'z')
        dl[k][j] = j - previous_z_index + 1;
      else {
        dl[k][j] = -1;
        previous_z_index = -1;
      }
    }
  }
  long long answer = 0;
  for (int col = 1; col <= M; col++) {
    answer += solve_a_diagonal(1, col);
  }
  for (int row = 2; row <= N; row++) {
    answer += solve_a_diagonal(row, M);
  }
  long long single = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (a[i][j] == 'z') single++;
    }
  }
  cout << answer + single << endl;
  return 0;
}
