#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert
#define aer(v) (v).erase((v).begin(),(v).end()) 
#define fh(x,v) for(auto x:v)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int h,w,ans;

int c(int y,int x){
	return y>=0&&x>=0&&y<h*w&&x<h*w;
}

main(){
	cin>>h>>w;
	int s[h+w-1][w+h-1]={};
	{
		int t[h][w]={};
		rep(i,h)rep(j,w){
			char c;
			cin>>c;
			if(c=='#')t[i][j]=1;
		}
		rep(i,h)rep(j,w){
			s[i+j][j-i+h-1]=t[i][j];
			debug(i,j,"->",i+j,j-i+h-1);
		}
		
	}
	rep(i,h+w-1){
		rep(j,w+h-1){
			cerr<<s[i][j]<<' ';
		}
		cerr<<endl;
	}
	int yo[h+w-1][h+w]={},ta[h+w][h+w-1]={};
	rep(i,h+w-1){
		rep(j,w+h-1){
			yo[i][j+1]+=yo[i][j]+s[i][j];
		}
	}
	rep(i,h+w-1){
		rep(j,w+h){
			cerr<<yo[i][j]<<' ';
		}
		cerr<<endl;
	}
	rep(i,h+w-1){
		rep(j,w+h-1){
			ta[i+1][j]+=ta[i][j]+s[i][j];
		}
	}
	rep(i,h+w-1){
		rep(j,h+w-1){
			if(s[i][j]){
				pint l={i,j},r={i,j};
				int cnt=2;//バグる可能性あり
				while(1){
					l.fi=max(0ll,l.fi-1);
					l.se=max(0ll,l.se-1);
					r.fi=min(h+w-2,r.fi+1);
					r.se=min(h+w-2,r.se+1);//累積和上の座標
					if(l.fi==0&&l.se==0&&r.fi==h+w-2&&r.se==h+w-2)break;
					//dump(l.fi,l.se,',',r.fi,r.se);*
					int t=yo[r.fi][r.se+1]-yo[r.fi][max(r.se-cnt,0ll)];
					//dump(r.fi-1,r.se+1,',',r.fi-1,max(r.se-cnt,0ll));
					//debug(t);
					t+=yo[l.fi][min(l.se+cnt+1,h+w-1)]-yo[l.fi][l.se];
					//dump(l.fi,l.se,',',r.fi,r.se);
					t+=ta[min(h+w-1,l.fi+cnt+1)][l.se]-ta[l.fi][l.se];
					//dump(l.fi,l.se,',',r.fi,r.se);
					t+=ta[r.fi+1][r.se]-ta[max(0ll,r.fi-cnt)][r.se];
					//dump(l.fi,l.se,',',r.fi,r.se);
					t-=s[l.fi][l.se];
					t-=s[r.fi][r.se];
					t-=s[l.fi][min(h+w-2,l.se+cnt)];
					t-=s[min(h+w-2,l.fi+cnt)][l.se];
					ans+=max(0ll,t*(t-1));
					
					cnt+=2;
				}
			}
			s[i][j]=0;
			for(int k=j+1;k<h+w;k++){
				yo[i][k]--;
			}
			for(int k=i+1;k<h+w;k++){
				ta[k][j]--;
			}
		}
	}
	dans;
	
}
/*
3 3
.#.
#.#
.#.
*/
/*
.....
.#.#.
.....
.#.#.
.....
*/


