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.
import sys
readline=sys.stdin.readline

N,M=map(int,readline().split())
grid=[readline().rstrip() for n in range(N)]
cntN=[0]*N
cntM=[0]*M
for n in range(N):
    for m in range(M):
        if grid[n][m]=="*":
            cntN[n]+=1
            cntM[m]+=1
ans=0
for n in range(N):
    for m in range(M):
        if grid[n][m]=="*":
            ans+=(cntN[n]-1)*(cntM[m]-1)
print(ans)