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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

pair<int, int> go(auto &pts) {
    vvi ct(600, vi(600));
    for (auto [x, y] : pts) {
        ct[y][x]++;
    }
    for (int y = 0; y < 600; y++) {
        for (int x = 1; x < 600; x++) {
            ct[y][x] += ct[y][x-1];
        }
    }

    auto get_ct = [&](int x0, int x1, int y) {
        if (y < 0 || y >= 600) return 0;
        x0 = max(x0, 0);
        x1 = min(x1, 599);
        if (x0 > x1) return 0;
        int res = ct[y][x1];
        if (x0) res -= ct[y][x0-1];
        return res;
    };

    int r1 = 0, r2 = 0;
    for (auto [x1, y1] : pts) {
        for (int dist = 1; dist <= 600; dist++) {
            int x2 = x1 + dist;

            r1 += get_ct(x2, x2, y1) *
                  ( get_ct(x1+1, x2-1, y1 - dist)
                  + get_ct(x1+1, x2-1, y1 + dist));
            r2 += get_ct(x2, x2, y1) *
                  ( get_ct(x1, x1, y1 - dist)
                  + get_ct(x1, x1, y1 + dist) );
            r2 += get_ct(x2, x2, y1) *
                  ( get_ct(x2, x2, y1 - dist)
                  + get_ct(x2, x2, y1 + dist));
        }
    }
    return { r1, r2 };
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);

    int R, C;
    cin >> R >> C;

    vector<array<int, 2>> p1, p2;
    for (int r = 0; r < R; r++) {
        string row;
        cin >> row;
        for (int c = 0; c < C; c++) {
            if (row[c] == '#') {
                p1.push_back({ r + c, r + 300 - c });
                p2.push_back({ r + 300 - c, r + c });
            }
        }
    }

    auto r1 = go(p1), r2 = go(p2);
    cout << r1.first + r2.first + r1.second << endl;
    return 0;
}

