You are given a *n* × *m* field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A right triangle is a triangle in which one angle is a right angle (that is, a 90 degree angle).
The first line contains two positive integer numbers *n* and *m* (1 ≤ *n*, *m* ≤ 1000). The following *n* lines consist of *m* characters each, describing the field. Only '.' and '*' are allowed.
r=range
i=input
n,m=map(int,i().split())
R=[[0 for x in r(m)]for y in r(n)]
C=[[0 for x in r(m)]for y in r(n)]
startR=[m+1 for x in r(m)]
startC=[n+1 for x in r(n)]
endR=[0 for x in r(m)]
endC=[0 for x in r(n)]
l=[]
for _ in r(n):
 l.append(list(i()))
for x in r(n):
 t=0
 for y in r(m):
  if(l[x][y]=='*'):
   startR[y]=min(startR[y],x)
   startC[x]=min(startC[x],y)
   endR[y]=max(endR[y],x)
   endC[x]=max(endC[x],y)
   t+=1
  R[x][y]=t
for y in r(m):
 t=0
 for x in r(n):
  if(l[x][y]=='*'):
   t+=1
  C[x][y]=t
t=0
for x in r(n-1):
 for y in r(m-1):
  if(l[x][y]=='*'):
   t+=abs((C[endR[y]][y]-C[x][y])*(R[x][endC[x]]-R[x][y]))
for x in r(n-1):
 for y in r(m-1):
  if(l[n-x-1][y]=='*'):
   t+=abs((C[startR[y]][y]-C[n-1-x][y])*(R[n-1-x][endC[n-1-x]]-R[n-1-x][y]))
for x in r(n-1):
 for y in r(m-1):
  if(l[x][m-1-y]=='*'):
   t+=abs((C[endR[m-1-y]][m-1-y]-C[x][m-1-y])*(R[x][startC[x]]-R[x][m-1-y]))
for x in r(n-1):
 for y in r(m-1):
  if(l[n-x-1][m-1-y]=='*'):
   t+=abs((C[startR[m-1-y]][m-1-y]-C[n-1-x][m-1-y])*(R[n-1-x][startC[n-1-x]]-R[n-1-x][m-1-y]))
print(t)
