#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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(const 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] == '#') {
    // cout << "double(" << x << ":" << y << ") "; 
    return true; 
  }
  return false;
}

ll solve(const vector<string>& s, ll h, ll w) {
  vector<vector<ll>> cum(h+w+1, vector<ll>(w+1));
  REP(ij, h+w) {
    REP(i, w) {
      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;
      }
    }
  }
  // REP(ij, h+w) {
  //   cout << ij << ":";
  //   REP(i, w+1) {
  //     cout << cum[ij][i] << " ";
  //   }
  //   cout << endl;
  // }
  ll ans = 0;
  REP(y, h) {
    REP(x, w) {
      if(s[y][x] == '.') continue;
      REP_FROM(i, 1, h+w) {
        if(y - i < 0|| w <= x + i) {
          break;
        }
        if(s[y-i][x+i] == '.') continue;
        // cout <<  x << ":" << y << ":" << x+i << ":" << y-i << endl;
        {
          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--;
            // cout << cum[ij][rgt+1] - cum[ij][lft] << "(" << rgt << ":" << lft << ")" << "||";
            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--;
            // cout << cum[ij][rgt+1] - cum[ij][lft] << "(" << rgt << ":" << lft << ")";
            ans += (cum[ij][rgt+1] - cum[ij][lft]) * 2;
          } 
        }
        // cout << endl;
      }
    }
  }
  // cout << ans << endl;
  return ans ;
}

signed main() {
  ios::sync_with_stdio(false);
  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  REP(i, h) cin >> s[i];
  ll ans = solve(s, h, w);
  REP(i, h) reverse(all(s[i]));
  // REP(i, h) cout << s[i] << endl;
  ans += solve(s, h, w);
  cout << ans / 2 << endl;
  return 0;
}


Measured memory_bytes: 1792