#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
const int INF = 1e9;

void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    int H,W;
    cin>>H>>W;
    char S[H][W];
    char S1[H][W];
    char S2[W][H];
    char S3[H][W];
    char S4[W][H];
    FOR(i,H){
        FOR(j,W){
            cin>>S[i][j];
        }
    }
    FOR(i,H){
        FOR(j,W){
            S1[i][j]=S[i][j];
            S2[j][i]=S[H-1-i][j];
            S3[i][j]=S[H-1-i][W-1-j];
            S4[j][i]=S[i][W-1-j];
        }
    }
    int i1,i2,j1,j2,i3,j3;
    int L;
    int k3;
    int cnt = 0;
    int sum1[H+W][H+1],sum3[H+W][H+1],sum2[H+W][W+1],sum4[H+W][W+1];//sum1[k3][i2] means accumulate sum of '#' such as 0=<i<i2 i+j=k3
    fill(sum1[0],sum1[0]+(H+W)*(H+1),0);
    fill(sum2[0],sum2[0]+(H+W)*(W+1),0);
    fill(sum3[0],sum3[0]+(H+W)*(H+1),0);
    fill(sum4[0],sum4[0]+(H+W)*(W+1),0);
    
    int x1,x2,x3,x4;
    FOR(k,H+W){
        x1=0;
        x3=0;
        FOR(i,H){//use H
            j=k-i;
            if(j<0 or j>=W) continue;//use W
            if(S1[i][j]=='#') x1+=1;
            if(S3[i][j]=='#') x3+=1;
            sum1[k][i+1]=x1;
            sum3[k][i+1]=x3;
        }
        //FORR(x,sum1[k]){
        //    cout<<x<<" ";
        //}
        //cout<<endl;
    }
    FOR(k,H+W){
        x2=0;
        x4=0;
        FOR(i,W){//use H
            j=k-i;
            if(j<0 or j>=H) continue;//use W
            if(S2[i][j]=='#') x2+=1;
            if(S4[i][j]=='#') x4+=1;
            sum2[k][i+1]=x2;
            sum4[k][i+1]=x4;
        }
        
    }
        
    FOR(k,H+W-2){

        FOR(i1,H){
            j1=k-i1;
            if(j1<0 or W<=j1) continue;
            FOR(i2,i1){
                j2=k-i2;
                if(j2<0 or W<=j2) continue;
                L=abs(i1-i2)+abs(j1-j2);
                k3=k-L;
                //0<=i3<i2,0<=j1<=j3
                //j3+i3=k3;
                //
                //0<=max(k3-j3,0)<=i3<min(i2,k3+1)<=i2
                if(k3<0) continue;
                x=max(k3-j1,0);
                y=min(i2,k3+1);
                if(y<=x) continue;
                if(S1[i1][j1]=='#' and S1[i2][j2]=='#') cnt += sum1[k3][y] - sum1[k3][x];                
                if(S3[i1][j1]=='#' and S3[i2][j2]=='#') cnt += sum3[k3][y] - sum3[k3][x];
            }
        }
    }
    FOR(k,H+W-2){
        FOR(i1,W){
            j1=k-i1;
            if(j1<0 or H<=j1) continue;
            FOR(i2,i1){
                j2=k-i2;
                if(j2<0 or H<=j2) continue;
                L=abs(i1-i2)+abs(j1-j2);
                k3=k-L;
                if(k3<0) continue;
                x=max(k3-j1,0);
                y=min(i2,k3+1);
                if(y<=x) continue;
                if(S2[i1][j1]=='#' and S2[i2][j2]=='#') cnt += sum2[k3][y] - sum2[k3][x];                
                if(S4[i1][j1]=='#' and S4[i2][j2]=='#') cnt += sum4[k3][y] - sum4[k3][x];
            }
        }
    } 
    cout<<cnt<<endl;
    /*cin>>N;
    vector<ll> V((N1+1)*(N+1));
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 3584