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.
def process(M):
    n = len(M)
    m = len(M[0])
    d1 = {}
    d2 = {}
    points = set([])
    answer = 0
    for i in range(n):
        for j in range(m):
            if M[i][j]=='*':
                points.add((i, j))
                if i not in d1:
                    d1[i] = 0
                if j not in d2:
                    d2[j] = 0
                d1[i]+=1
                d2[j]+=1
    for i, j in points:
        a1 = d1[i]-1
        a2 = d2[j]-1
        answer = answer+(a1*a2)
    return answer
                

n, m = [int(x) for x in input().split()]
M = []
for i in range(n):
    row = input()
    M.append(row)
print(process(M))