#include<bits/stdc++.h>

#define db(x) cout<<#x<<"="<<(x)<<" "
#define el cout<<endl
using namespace std;

typedef long long ll;
const int MXN = 610;
const int MOD = 998244353, inv2 = MOD - MOD / 2;

int n, m;
char str[MXN][MXN];
int g[MXN][MXN] = {};
long long ans;

void solve(int n, int m) {
    //db(g[3][3]), el;
    for (int t = 0; t < n + m - 1; ++t) {
        int o = 0;
        for (int i = t; i >= 0; --i) {
            o += g[i][t - i];
            //db(i), db(o), el;
            int oo = o;
            for (int j = 0; j <= t - i; j++) {
                oo -= g[t - j][j];
                //db(oo), el;
                if (j + j + i - t >= 0)
                    if (i + i + j - t >= 0)
                        if (g[i][j + j + i - t] && g[i + i + j - t][j])
                            ans += oo;
            }
        }
    }
    memset(g, 0, sizeof(g));
}
int main() {
    scanf("%d %d\n", &n, &m);
    for (int i = 0; i < n; ++i)
        scanf("%s\n", str[i]);
    //n = m = max(n, m);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j) {
            g[i][j] = str[i][j] == '#';
        }
    solve(n, m);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            g[j][n - i - 1] = str[i][j] == '#';
    solve(m, n);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            g[n - i - 1][m - j - 1] = str[i][j] == '#';
    solve(n, m);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            g[m - j - 1][i] = str[i][j] == '#';
    solve(m, n);
    cout << ans << endl;
    return 0;
}