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.
#/usr/bin/python3

#k=1000

D=list( map( int, input().split() ) )
N,M=D[0],D[1]
A=[[0 for g in range(M)] for i in range(N)]
B=[[0 for g in range(3)] for i in range(N)]
C=[[0 for i in range(3)] for g in range(M)]
#s=['*'*k for i in range(k)]
for i in range(N):
    a=input()
    #a=s[i]
    for g in range(M):
        if a[g] == "*":
            A[i][g]=1
            B[i][2]+=1
    B[i][1]=B[i][2]-1

del(a)
for g in range(M):
    for i in range(N):
        C[g][2]+=A[i][g]
    C[g][1]=C[g][2]-1
#print(A,"\nstroki ->",B,"\nstolbci ->",C)

ans=0

for i in range(N):
    for g in range(M):
        if A[i][g] == 1:
            
            B[i][0]+=1
            C[g][0]+=1
            B[i][1]-=1
            C[g][1]-=1
            
            # II
            ans+=B[i][0]*C[g][0]
            # I
            ans+=B[i][1]*C[g][0]
            # III
            ans+=B[i][0]*C[g][1]
            # IV
            ans+=B[i][1]*C[g][1]
            
print(ans)