#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    int H, W; cin >> H >> W;
    vector<string> s(H);
    REP(i, H) cin >> s[i];

    mat sum1(H + 2 * W, vec(W + 1, 0)), sum2(H + 2 * W, vec(W + 1, 0));
    REP(i, H + 2 * W){
        REP(j, W){
            int x = i - W + j, y = j;
            if(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1 && s[x][y] == '#') sum1[i][j + 1] = sum1[i][j] + 1;
            else sum1[i][j + 1] = sum1[i][j];
            x = i - W - j, y = j;
            if(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1 && s[x][y] == '#') sum2[i][j + 1] = sum2[i][j] + 1;
            else sum2[i][j + 1] = sum2[i][j];
        }
    }

    /*
    REP(i, H + 2 * W){
        REP(j, W + 1){
            cout << sum1[i][j] << ",";
        }
        cout << endl;
    }*/



    int ans = 0;
    REP(i, H){
        REP(j, W){
            if(s[i][j] == '.') continue;

            FOR(n, 1, INF){
                int x = i + n, y = j + n;
                if(!(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1)) break;
                if(s[x][y] == '#'){
                    if(i - j - 2 * n + W >= 0)
                    ans += sum1[i - j - 2 * n + W][min(j + 2 * n + 1, W)] - sum1[i - j - 2 * n + W][j + n];
                    if(i - j + 2 * n  + W < H + 2 * W)
                    ans += sum1[i - j + 2 * n + W][j + 1] - sum1[i - j + 2 * n + W][max(j - n, 0LL)];
                }
            }

            FOR(n, 1, INF){
                int x = i - n, y = j + n;
                if(!(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1)) break;
                if(s[x][y] == '#'){
                    if(i + j - 2 * n + W >= 0)
                    ans += sum2[i + j - 2 * n + W][j + 1] - sum2[i + j - 2 * n + W][max(j - n, 0LL)];
                    if(i + j + 2 * n  + W < H + 2 * W)
                    ans += sum2[i + j + 2 * n + W][min(j + 2 * n + 1, W)] - sum2[i + j + 2 * n + W][j + n];
                }
            }

        }
    }
    
    //重複している分を取る除く
    REP(i, H){
        REP(j, W){
            if(s[i][j] == '.') continue;

            FOR(n, 1, INF){
                int x = i + 2 * n, y = j, a, b;
                if(!(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1)) break;
                if(s[x][y] == '#'){
                    a = i + n, b = j + n;
                    if(0 <= a && a <= H - 1 && 0 <= b && b <= W - 1 && s[a][b] == '#') ans--;
                    a = i + n, b = j - n;
                    if(0 <= a && a <= H - 1 && 0 <= b && b <= W - 1 && s[a][b] == '#') ans--;
                }
            }

            FOR(n, 1, INF){
                int x = i, y = j + 2 * n, a, b;
                if(!(0 <= x && x <= H - 1 && 0 <= y && y <= W - 1)) break;
                if(s[x][y] == '#'){
                    a = i + n, b = j + n;
                    if(0 <= a && a <= H - 1 && 0 <= b && b <= W - 1 && s[a][b] == '#') ans--;
                    a = i - n, b = j + n;
                    if(0 <= a && a <= H - 1 && 0 <= b && b <= W - 1 && s[a][b] == '#') ans--;
                }
            }
        }
    }


    cout << ans;
    
    return 0;
}

Measured memory_bytes: 4736