#include <bits/stdc++.h>
const int MAX_N = 3005;
const double eps = 1e-6;
const int inf = (int)1e9 + 123;
using namespace std;
int n, m;
char a[MAX_N][MAX_N];
vector<int> del[MAX_N][MAX_N];
long long res;
int L[MAX_N][MAX_N], R[MAX_N][MAX_N];
set<int> q;
int first[MAX_N];
void clear() {
  q.clear();
  for (int i = 0; i <= max(n, m); i++) first[i] = 0;
}
void update(int x, int val) {
  for (int i = x; i <= max(n, m); i |= (i + 1)) first[i] += val;
}
int get(int x) {
  int res = 0;
  for (int i = x; i >= 0; i = (i & (i + 1)) - 1) res += first[i];
  return res;
}
int sum(int l, int r) {
  int res = get(r);
  if (l > 0) res -= get(l - 1);
  return res;
}
void delt(int x) {
  if (!q.count(x)) return;
  q.erase(q.find(x));
  update(x, -1);
}
void add(int x) {
  q.insert(x);
  update(x, 1);
}
void solve(int x, int y) {
  clear();
  for (int i = x, j = y; i < n && j >= 0; i++, j--) {
    if (a[i][j] == '.') {
      while (!q.empty()) delt(*q.begin());
      continue;
    }
    for (auto it : del[i][j]) delt(it);
    add(i);
    if (i + L[i][j] < n && j - L[i][j] >= 0)
      del[i + L[i][j]][j - L[i][j]].push_back(i);
    res += sum(max(0, i - R[i][j] + 1), i);
  }
}
int main() {
  scanf("%d %d\n", &n, &m);
  for (int i = 0; i < n; i++) gets(a[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '.') continue;
      L[i][j] = 1;
      if (j > 0) L[i][j] += L[i][j - 1];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = m - 1; j >= 0; j--) {
      if (a[i][j] == '.') continue;
      R[i][j] = 1;
      if (j + 1 < m) R[i][j] += R[i][j + 1];
    }
  }
  for (int j = 0; j < m; j++) solve(0, j);
  for (int i = 1; i < n; i++) solve(i, m - 1);
  printf("%lld", res);
  return 0;
}
