#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int h, w;
bool s[310][310];
int bo[610][610];
int bob[610][610];

bool inmap(int x, int y) {
    if (x >= 0 && x < h && y >= 0 && y < w) {
        return true;
    } else {
        return false;
    }
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        string ss;
        cin >> ss;
        for (int j = 0; j < w; j++) {
            if (ss[j] == '#') {
                s[i][j] = true;
            } else {
                s[i][j] = false;
            }
        }
    }
    for (int i = 0; i < 610; i++) {
        fill(bo[i], bo[i] + 610, 0);
    }
    int big = max(h, w);
    for (int i = - big; i < big; i++) {
        for (int j = 0; j < w; j++) {
            bo[i + big][j + 1] = bo[i + big][j];
            int x = i + j;
            int y = j;
            if (inmap(x, y)) {
                if (s[x][y]) {
                    bo[i + big][j + 1]++;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = - big; i < big; i++) {
        for (int j = 0; j < w; j++) {
            int firx = i + j;
            int firy = j;
            if (inmap(firx, firy)) {
                for (int k = 1; k < w; k++) {
                    int secx = firx + k;
                    int secy = firy + k;
                    if (!inmap(secx, secy)) {
                        break;
                    }
                    if (s[firx][firy] && s[secx][secy]) {
                        int l = 2 * k;
                        int boia = i - l;
                        int boja = j + k;
                        int bojb = min(j + 2 * k, w - 1);
                        if (boia + big >= 0 && boia + big < 2 * big) {
                            ans += bo[boia + big][bojb + 1] - bo[boia + big][boja];
                        }
                        // if (bo[boia + h][bojb + 1] - bo[boia + h][boja] > 0) {
                        //     cout << bo[boia + h][bojb + 1] << " " << bo[boia + h][boja] << " " << firx
                        //          << " " << firy << " " << secx << " " << secy << " aaa" << endl;
                        // }
                        boia = i + l;
                        boja = max(0, j - k);
                        bojb = j;
                        if (boia + big >= 0 && boia + big < 2 * big) {
                            ans += bo[boia + big][bojb + 1] - bo[boia + big][boja];
                        }
                        // if (bo[boia + h][bojb + 1] - bo[boia + h][boja] > 0) {
                        //     cout << bo[boia + h][bojb + 1] << " " << bo[boia + h][boja] << " " << firx
                        //          << " " << firy << " " << secx << " " << secy << " bbb" <<  k <<  endl;
                        // }
                    }
                }
            }
        }
    }
    //cout << ans << endl;
    for (int i = 0; i < 610; i++) {
        fill(bob[i], bob[i] + 610, 0);
    }
    for (int i = 0; i < 2 * big; i++) {
        for (int j = 0; j < w; j++) {
            bob[i][j + 1] = bob[i][j];
            int x = i - j;
            int y = j;
            if (inmap(x, y)) {
                if (s[x][y]) {
                    bob[i][j + 1]++;
                }
            }
        }
    }
    for (int i = 0; i < 2 * big; i++) {
        for (int j = 0; j < w; j++) {
            int firx = i - j;
            int firy = j;
            if (inmap(firx, firy)) {
                for (int k = 1; k < w; k++) {
                    int secx = firx - k;
                    int secy = firy + k;
                    if (!inmap(secx, secy)) {
                        break;
                    }
                    if (s[firx][firy] && s[secx][secy]) {
                        int l = 2 * k;
                        int boia = i - l;
                        int boja = max(j - k + 1, 0);
                        int bojb = j - 1;
                        if (boia >= 0 && boia < 2 * big) {
                            ans += bob[boia][bojb + 1] - bob[boia][boja];
                        }
                        // if (bo[boia][bojb + 1] - bo[boia][boja] > 0) {
                        //     cout << bo[boia][bojb + 1] - bo[boia][boja] << " " << firx << " " << firy <<
                        //         " " << secx << " " << secy << " aaa" << endl;
                        // }
                        boia = i + l;
                        boja = j + k + 1;
                        bojb = min(j + 2 * k - 1, w - 1);
                        if (boia >= 0 && boia < 2 * big) {
                            ans += bob[boia][bojb + 1] - bob[boia][boja];
                        }
                        // if (bo[boia][bojb + 1] - bo[boia][boja] > 0) {
                        //     cout << bo[boia][bojb + 1] - bo[boia][boja] << " " << firx << " " << firy <<
                        //         " " << secx << " " << secy << " bbb" << endl;
                        // }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3200