#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long mod2 = 998244353;
long long mod3 = 1000003;
long long mod4 = 998244853;
long long inf = 1LL << 60;
long double pi = 3.14159265358979323846L;
double eps = 1e-12;
int dh[4] = {1, -1, 0, 0};
int dw[4] = {0, 0, 1, -1};
int ddh[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int ddw[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long Pow(long long n, long long k) {
  long long ret = 1;
  long long now = n;
  while (k > 0) {
    if (k & 1) ret *= now;
    now *= now;
    k /= 2;
  }
  return ret;
}
long long beki(long long n, long long k, long long md) {
  long long ret = 1;
  long long now = n;
  while (k > 0) {
    if (k % 2 == 1) {
      ret *= now;
      ret %= md;
    }
    now *= now;
    now %= md;
    k /= 2;
  }
  return ret;
}
long long gyaku(long long n, long long md) { return beki(n, md - 2, md); }
int sum[2001][2001];
long long f(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int h, w;
  cin >> h >> w;
  string s[h];
  for (long long i = 0; i < h; i++) cin >> s[i];
  bool ex[2001][2001];
  memset(ex, false, sizeof ex);
  memset(sum, 0, sizeof sum);
  for (long long i = 0; i < h; i++) {
    for (long long j = 0; j < w; j++) {
      if (s[i][j] == '.') continue;
      int x = i + j + 1000;
      int y = j - i + 1000;
      sum[x][y] = 1;
      ex[x][y] = true;
    }
  }
  for (long long i = 1; i < 2001; i++) {
    for (long long j = 1; j < 2001; j++) {
      sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    }
  }
  long long ans = 0;
  long long cnt = 0;
  for (long long i = 0; i < h; i++) {
    for (long long j = 0; j < w; j++) {
      if (s[i][j] == '.') continue;
      int x = i + j + 1000;
      int y = j - i + 1000;
      for (int k = 2; k <= 300; k += 2) {
        int nx = x, ny = y + k;
        int nex = x + k, ney = y;
        if (ex[nx][ny]) {
          ans += f(nex, ney + 1, nex, ny - 1);
          ans += f(nx - k, ney + 1, nx - k, ny - 1);
          if (ex[nex][ney]) cnt++;
        }
        nx = nex, ny = ney;
        nex = x, ney = y - k;
        if (ex[nx][ny]) {
          ans += f(nex + 1, ney, nx - 1, ney);
          ans += f(nex + 1, ney + 2 * k, nx - 1, ny + k);
          if (ex[nex][ney]) cnt++;
        }
        nx = nex, ny = ney;
        nex = x - k, ney = y;
        if (ex[nx][ny]) {
          ans += f(nex, ny + 1, nex, ney - 1);
          ans += f(nex + 2 * k, ny + 1, nex + 2 * k, ney - 1);
          if (ex[nex][ney]) cnt++;
        }
        nx = nex, ny = ney;
        nex = x, ney = y + k;
        if (ex[nx][ny]) {
          ans += f(nx + 1, ney, nex - 1, ney);
          ans += f(nx + 1, ney - 2 * k, nex - 1, ney - 2 * k);
          if (ex[nex][ney]) cnt++;
        }
      }
    }
  }
  cout << ans / 2 + cnt << endl;
}
