#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
// #define DEBUGGING

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

namespace __init {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

PLL calc(const V<string> &vs, ll H, ll W) {
    auto sum = make_v<ll>(0, H + W + 10, H + W + 10);
    auto len = make_v<ll>(0, H + W + 10);

    auto check_range = [&](ll h, ll w) {
        return 0 <= h && h < H &&
               0 <= w && w < W;
    };

    auto check_mark = [&](ll h, ll w) {
        return check_range(h, w) && vs[h][w] == '#';
    };

    for(ll i = 0; i < H + W - 1; i++) {
        ll h = max<ll>(0, i - (W - 1));
        ll w = min<ll>(W - 1, i);
        for(ll j = 0;; j++) {
            ll nh = h + j;
            ll nw = w - j;
            if(!check_range(nh, nw)) break;
            len[i]++;
            sum[i][j + 1] = sum[i][j] + check_mark(nh, nw);
        }
    }

    auto to_idx = [&](ll h, ll w) {
        ll id = w + h;
        ll oh = max<ll>(0, id - (W - 1));
        ll ow = min<ll>(W - 1, id);
        ll hw_idx = h - oh;
        return make_pair(id, hw_idx);
    };

    ll ans = 0, cnt_dup = 0;

    auto calc_pairs = [&](ll h1, ll w1, ll h2, ll w2, ll dist) {
        PLL idx1 = to_idx(h1, w1 - dist);
        PLL idx2 = to_idx(h2 - dist, w2);
        ll id = idx1.first;
        ll low = min<ll>(len[id] - 1, max<ll>(idx2.second, 0));
        ll high = min<ll>(len[id] - 1, max<ll>(idx1.second, 0)) + 1; 
        ans += sum[id][high] - sum[id][low];
        DEBUG(id, h1, w1, h2, w2, low, high, sum[id][high]-sum[id][low]);
        cnt_dup += check_mark(h1 - dist / 2, w1 - dist / 2) +
                   check_mark(h2 - dist / 2, w2 - dist / 2);
    };

    for(ll i = 0; i < H + W - 1; i++) {
        ll h = max<ll>(0, i - (W - 1));
        ll w = min<ll>(W - 1, i);
        DEBUG(i, h, w);
        for(ll j = 0;; j++) {
            ll h1 = h + j, w1 = w - j;
            if(!check_range(h1, w1)) break;
            if(!check_mark(h1, w1)) continue;
            for(ll k = j + 1;; k++) {
                ll h2 = h + k, w2 = w - k;
                if(!check_range(h2, w2)) break;
                if(!check_mark(h2, w2)) continue;
                ll dist = (k - j) * 2;
                if(i - dist < 0) break;
                calc_pairs(h1, w1, h2, w2, dist);
            }
        }
    }
    return make_pair(ans, cnt_dup);
}

V<string> rotate(const V<string> &vs) {
    ll H = vs.size(), W = vs[0].size();
    V<string> ret(W, string(H, '.'));
    for(ll i = 0; i < H; i++) for(ll j = 0; j < W; j++) ret[j][H - i - 1] = vs[i][j]; 
    return move(ret);
}

int main() {
    ll H, W;
    cin >> H >> W;
    V<string> vs(H);
    for(auto &s : vs) cin >> s;
    ll ans = 0;
    for(ll i = 0; i < 4; i++) {
        PLL ret = calc(vs, H, W);
        DEBUG(ret);
        ans += ret.first;
        if(i % 2 == 0) ans -= ret.second;
        if(i < 3) {
            auto tmp = rotate(vs);
            vs = move(tmp);
            swap(H, W);
#ifdef DEBUGGING
            for(auto &s : vs) cout << s << endl;
#endif
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3348