#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
ll power(ll base, ll exponent, ll module) {
  if (exponent % 2) {
    return power(base, exponent - 1, module) * base % module;
  } else if (exponent) {
    ll root_ans = power(base, exponent / 2, module);
    return root_ans * root_ans % module;
  } else {
    return 1;
  }
}
ll inverse(ll x) { return power(x, mod - 2, mod); }
ll gcd(ll a, ll b) {
  if (a < b) gcd(b, a);
  ll r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}
struct combination {
  vector<ll> fact, inv;
  combination(int sz) : fact(sz + 1), inv(sz + 1) {
    fact[0] = 1;
    for (int i = 1; i <= sz; i++) {
      fact[i] = fact[i - 1] * i % mod;
    }
    inv[sz] = power(fact[sz], mod - 2, mod);
    for (int i = sz - 1; i >= 0; i--) {
      inv[i] = inv[i + 1] * (i + 1) % mod;
    }
  }
  ll C(int p, int q) const {
    if (q < 0 || p < q) return 0;
    return (fact[p] * inv[q] % mod * inv[p - q] % mod);
  }
};
int bsearch(const vector<ll>& a, ll x) {
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if (a[mid] < x) {
      lft = mid;
    } else {
      rgt = mid;
    }
  }
  return lft;
}
bool check(vector<string> s, int x, int y) {
  if (x < 0 || y < 0 || s[0].size() <= x || s.size() <= y) return false;
  if (s[y][x] == '#') {
    return true;
  }
  return false;
}
ll solve(vector<string> s, ll h, ll w) {
  vector<vector<ll>> cum(h + w + 1, vector<ll>(w + 1));
  for (ll ij = 0; ij < (h + w); ++ij) {
    for (ll i = 0; i < (w); ++i) {
      int j = ij - i;
      if (j < 0 || h <= j) {
        cum[ij][i + 1] = cum[ij][i];
      } else if (s[j][i] == '.') {
        cum[ij][i + 1] = cum[ij][i];
      } else {
        cum[ij][i + 1] = cum[ij][i] + 1;
      }
    }
  }
  return -1;
  ll ans = 0;
  for (ll y = 0; y < (h); ++y) {
    for (ll x = 0; x < (w); ++x) {
      if (s[y][x] == '.') continue;
      for (ll i = (1); i < (h + w); ++i) {
        if (y - i < 0 || w <= x + i) {
          break;
        }
        if (s[y - i][x + i] == '.') continue;
        {
          ll ij = x + y - i * 2;
          if (0 <= ij) {
            ll lft = max(x - i, 0ll);
            ll rgt = min(x, w - 1);
            if (check(s, x - i, y - i)) ans--;
            if (check(s, x, y - i * 2)) ans--;
            ans += (cum[ij][rgt + 1] - cum[ij][lft]) * 2;
          }
        }
        {
          ll ij = x + y + i * 2;
          if (ij < w + h) {
            ll lft = min(x + i, w - 1);
            ll rgt = min(x + i * 2, w - 1);
            if (check(s, x + i, y + i)) ans--;
            if (check(s, x + i * 2, y)) ans--;
            ans += (cum[ij][rgt + 1] - cum[ij][lft]) * 2;
          }
        }
      }
    }
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(false);
  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (ll i = 0; i < (h); ++i) cin >> s[i];
  ll ans = solve(s, h, w);
  for (ll i = 0; i < (h); ++i) reverse((s[i]).begin(), (s[i]).end());
  ans += solve(s, h, w);
  cout << ans / 2 << endl;
  return 0;
}
