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.
n,m=map(int,input().split())
a=[[0 for i in range(m+1)]]
b=[[0 for i in range(m+2)]for j in range(n+2)]
c=[[0 for i in range(m+2)]for j in range(n+2)]
s=[]
for i in range(m):
    p=input()
    r=[]
    for j in p:
        if j=='.':
            r.append(0)
        else:
            r.append(1)
    r.insert(0,0)
    a.append(r)
for i in range(1,n+1):
    for j in range(1,m+1):
       # print(i,j)
        b[i][j]=b[i-1][j]+a[i][j]
        c[i][j]=c[i][j-1]+a[i][j]
t=0
for i in range(1,n+1):
    for j in range(1,m+1):
        if a[i][j]==1:
            t+=(b[i][j]-1)*(c[i][j]-1)
            t+=(b[n][j]-b[i][j])*(c[i][j]-1)
            t+=(b[i][j]-1)*(c[i][m]-c[i][j])
            t+=(b[n][j]-b[i][j])*(c[i][m]-c[i][j])
print(t)
 	 		  	  	 	 					   	 		   		