#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>
using namespace std;
#define all(x) (x).begin(), (x).end()
 
const int N = 500000;
const long long MOD = 1e9 + 7;
 
int n, m;
vector<string> s;
long long ans = 0;
 
void R()
{
    vector<string> f(m, string(n, ' '));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            f[m - 1 - j][i] = s[i][j];
        }
    }
    swap(n, m);
    s = f;
    return;
}
 
void F()
{
    vector<vector<int> > summ(n, vector<int>(m));
    function<int(int, int)>G = [&](int i, int j)
    {
        if (j < 0 || j + i < 0 || i >= n) return 0;
        if (i < 0)
        {
            j -= -i;
            i += -i;
        }
        return summ[i][j];
    };
    function<int(int, int)>M = [&](int i, int j)
    {
        if (i < 0 || j < 0 || i >= n || j >= m) return 0;
        return (int)(s[i][j] == '#');
    };
    for (int si = 0; si < n + m - 1; si++)
    {
        for (int i = si; i >= 0; i--)
        {
            int j = si - i;
            if (0 <= i && i < n && 0 <= j && j < m)
            {
                summ[i][j] = G(i + 1, j - 1) + M(i, j);
            }
        }
    }
    for (int s = 0; s < n + m - 1; s++)
    {
        for (int i1 = 0; i1 <= s; i1++)
        {
            for (int i2 = 0; i2 <= s; i2++)
            {
                int j1 = s - i1, j2 = s - i2;
                if (j1 < j2 && 0 <= j1 && j1 < m && 0 <= j2 && j2 < m && M(i1, j1) && M(i2, j2))
                {
                    int k = j2 - j1;
                    int i3 = i2, j3 = j1 - k;
                    int i4 = i2 - k, j4 = j1;
                    i3++, j3--;
                    ans += G(i4, j4) - G(i3, j3);
                }
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            for (int k = 1; k <= 300; k++)
            {
                if (M(i + k, j) && M(i, j + k) && M(i - k, j)) ans--;
            }
        }
    }
}
 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    s.resize(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    F();
    R();
    F();
    R();
    F();
    R();
    F();
    cout << ans;
}