#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

VV<int> trans(VV<int> vec) {
    int H = vec.size(), W = vec[0].size();
    VV<int> res(W, V<int>(H));
    rep(i, H) {
        rep(j, W) { res[W - 1 - j][i] = vec[i][j]; }
    }
    return res;
}

int main() {
    int H, W;
    cin >> H >> W;
    VV<int> vec(H);
    rep(i, H) {
        string s;
        cin >> s;
        rep(j, W) vec[i].pb(s[j] == '#');
    }

    ll ans = 0;

    rep(t, 2) {
        VV<int> acm(H + W, V<int>(H + 1));
        rep(i, H + W) {
            rep(j, H) {
                int k = i - j;
                if (k >= 0 && k < W && vec[j][k]) {
                    acm[i][j + 1]++;
                }
                acm[i][j + 1] += acm[i][j];
            }
        }

        rep(i, H + W) {
            V<int> is;
            rep(j, H) {
                int k = i - j;
                if (k >= 0 && k < W && vec[j][k]) {
                    is.pb(j);
                }
            }
            rep(p, is.size()) {
                rep(q, p) {
                    int d = (is[p] - is[q]) * 2;
                    if (i - d >= 0) {
                        if (is[q]) ans += acm[i - d][is[q]];
                        if (is[p] - d + 1 >= 0) {
                            ans -= acm[i - d][is[p] - d + 1];
                        }
                    }
                    if (i + d < H + W) {
                        ans += acm[i + d][min(H, is[q] + d)];
                        ans -= acm[i + d][is[p] + 1];
                    }
                }
            }
        }
        vec = trans(vec);
        swap(H, W);
    }

    rep(i, H) {
        rep(j, W) {
            for (int d = 1; d <= 300; ++d) {
                int c = 0;
                if (i - d >= 0 && vec[i - d][j]) {
                    c++;
                }
                if (i + d < H && vec[i + d][j]) {
                    c++;
                }
                if (j - d >= 0 && vec[i][j - d]) {
                    c++;
                }
                if (j + d < W && vec[i][j + d]) {
                    c++;
                }

                ans += c * (c - 1) * (c - 2) / 6;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2304