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())
grid = [ input().strip() for r in range(n) ]

col_dirs = [ [ 0 for c in range(m) ] for r in range(n) ]
for c in range(m):
    count = -1
    for r in range(n):
        if grid[r][c] == '*':
            count += 1
            col_dirs[r][c] += count
    count = -1
    for r in range(n - 1, -1, -1):
        if grid[r][c] == '*':
            count += 1
            col_dirs[r][c] += count

row_dirs = [ [ 0 for c in range(m) ] for r in range(n) ]
for r in range(n):
    count = -1
    for c in range(m):
        if grid[r][c] == '*':
            count += 1
            row_dirs[r][c] += count
    count = -1
    for c in range(m - 1, -1, -1):
        if grid[r][c] == '*':
            count += 1
            row_dirs[r][c] += count

#print(grid)
#print(col_dirs)
#print(row_dirs)

total = 0
for r in range(n):
    for c in range(m):
        total += row_dirs[r][c] * col_dirs[r][c]
print(total)
