#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T&x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long s64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define rep0(i,l,r) for(int i=l;i<r;++i)
#define gc (c=getchar())
int read()
{
	char c;
	while(gc<'-');
	if(c=='-')
	{
		int x=gc-'0';
		while(gc>='0')x=x*10+c-'0';
		return -x;
	}
	int x=c-'0';
	while(gc>='0')x=x*10+c-'0';
	return x;
}
#undef gc

const int N=600+5;
int n,m;
char s[N][N];
bool b[N][N];
int left_s[N][N],up_s[N][N],left_s1[N][N];

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
#endif
	cin>>n>>m;
	rep(i,1,n)scanf("%s",s[i]+1);
	rep(i,1,n)
	rep(j,1,m)b[i+m-j][i+j]=s[i][j]=='#';
	rep(i,1,N-1)
	rep(j,1,N-1)
	{
		left_s[i][j]=left_s[i][j-1]+b[i][j];
		up_s[i][j]=up_s[i-1][j]+b[i][j];
	}
	s64 ans=0;
	rep(k,1,n-1+m-1)
	{
		rep(i,1,N-1)
		rep(j,1,N-1)left_s1[i][j]=left_s1[i][j-1]+(j>=k&&b[i][j]&&b[i][j-k]);
		rep(i,1,n)
		rep(j,1,m)
		if(s[i][j]=='#')
		{
			int x=i+m-j,y=i+j;
			if(x<=k)continue;
			if(y>k&&b[x][y-k])ans+=left_s[x-k][y]-left_s[x-k][y-k-1];
			if(b[x-k][y])
			{
				if(y>k)ans+=up_s[x-1][y-k]-up_s[x-k][y-k];
				if(y+k<N)ans+=up_s[x-1][y+k]-up_s[x-k][y+k];
			}
			ans+=left_s1[x-k][min(N-1,y+k)]-left_s1[x-k][y-1];
		//	if(y+k<N&&b[x][y+k])ans+=left_s[x-k][y+k]-left_s[x-k][y-1];
		}
	}
	cout<<ans;
}
