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 PROBLEM():
    n,m=map(int,input().split())
    T=[]
    for i in range(n):
        T.append(input())
    s=0
    for i in range(n):
        ch=T[i]
        Tp=RecherchePos(ch)
        for p in range(n):
            if i!=p:
                for j in Tp:
                    if ch[j]=='*' and T[p][j]=='*':
                        s+=T[p].count('*')-1
    print(s)
def RecherchePos(ch):
    T=[]
    p=0
    s=0
    while p!=-1 and ch!='':
        p=ch[s:].find('*')
        if p!=-1:
            T.append(p+s)
            s+=p+1
    return T
            
PROBLEM()