import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

def pzprint(n,z,zz,u,uu,sump,z3,z4,l2,r2):
    s1 = "{}) z {} zz {} u {} uu {} sump {}".format( \
                    n,z,zz,u,uu,sump)
    s2 = "  z3 {} z4 {} l2 {} r2 {}".format( \
                    z3,z4,l2,r2)
    s3 = " p1 {},{} p2 {},{}".format( \
            (z+u)//2, (u-z)//2, (zz+u)//2, (u-zz)//2)
    s4 = " p3 {},{} p4 {},{}".format( \
      (z3+uu)//2, (uu-z3)//2, (z4+1+uu)//2, (uu-z4-1)//2 )
    ddprint(s1)
    ddprint(s2)
    ddprint(s3)
    ddprint(s4)

def puprint(n,z,zz,u,uu,sump,u3,u4,l2,h2):
    s1 = "{}) z {} zz {} u {} uu {} sump {}".format( \
                    n,z,zz,u,uu,sump)
    s2 = "  u3 {} u4 {} l2 {} h2 {}".format( \
                    u3,u4,l2,h2)
    s3 = " p1 {},{} p2 {},{}".format( \
            (z+u)//2, (u-z)//2, (z+uu)//2, (uu-z)//2)
    s4 = " p3 {},{} p4 {},{}".format( \
      (zz+u3)//2, (u3-zz)//2, (zz+u4+1)//2, (u4+1-zz)//2 )
    ddprint(s1)
    ddprint(s2)
    ddprint(s3)
    ddprint(s4)


h,w = inm()
s = [ [] for i in range(h) ]
for i in range(h):
    ss = input()
    s[i] = [1 if ss[j]=='#' else 0 for j in range(w)]

b = [ [0]*(w+h+2) for j in range(w+h+2) ]
cnt = 1
for i in range(h):
    for j in range(w):
        b[i-j][i+j] = s[i][j]
        #if s[i][j] > 0:
        #  b[i-j][i+j] = cnt
        #  cnt += 1
        ddprint("b {} {} frm s {} {}: {}".format( \
            i-j,i+j,i,j,s[i][j]))

ddprint("s")
for i in range(h):
  ddprint(s[i])
ddprint("b")
for i in range(w+h+2):
  if DBG:
    printn("{}: ".format(i))
  ddprint(b[i])

accz = [ [0]*(w+h+2) for j in range(w+h+2) ]
accu = [ [0]*(w+h+2) for j in range(w+h+2) ]
for z in range(w+h+2):
    for u in range(w+h+2):
        accz[z-h][u] = accz[z-1-h][u] + b[z-h][u]
        accu[z-h][u] = accu[z-h][u-1] + b[z-h][u]

ddprint("accz")
for i in range(w+h+2):
  ddprint(accz[i])
ddprint("accu")
for i in range(w+h+2):
  ddprint(accu[i])

sum = 0
for u in range(w+h):
    lft = -u if u<w else u-2*w+2
    rgt =  u if u<h else 2*h-u-2
    for z in range(lft, rgt+1):
        if b[z][u]==0:
            continue
        for zz in range(z+1,rgt+1):
            if b[zz][u]==0:
                continue
            uu = u - (zz-z)
            if uu>=0:   # 単にzz..zでよいか？-右側はNG
                lft2 = -uu if uu<w else uu-2*w+2
                rgt2 =  uu if uu<h else 2*h-uu-2
                z3 = min(zz,rgt2)
                z4 = max(z,lft2)-1
                sump = accz[z3][uu] - accz[z4][uu]
                sum += sump
                if sump!=0:
                  pzprint( \
                    1,z,zz,u,uu,sump,z3,z4,lft2,rgt2)
            uu = u + (zz-z)
            if uu<=w+h:
                lft2 = -uu if uu<w else uu-2*w+2
                rgt2 =  uu if uu<h else 2*h-uu-2
                z3 = min(zz,rgt2)
                z4 = max(z,lft2)-1
                sump = accz[z3][uu] - accz[z4][uu]
                sum += sump
                if sump!=0:
                  pzprint( \
                    2,z,zz,u,uu,sump,z3,z4,lft2,rgt2)

for z in range(-w+1,h):
    lo = abs(z)
    hi =  2*w+z-2 if z<h-w else 2*h-z-2
    for u in range(lo, hi+1):
        if b[z][u]==0:
            continue
        for uu in range(u+2,hi+1):
            if b[z][uu]==0:
                continue
            zz = z - (uu-u)
            if zz >= -h:
                lo2 = abs(zz)
                hi2 =  2*w+zz-2 if zz<h-w else 2*h-zz-2
                u3 = min(uu-1,hi2)
                u4 = max(u+1,lo2)-1
                sump = accu[zz][u3] - accu[zz][u4]
                sum += sump
                if sump!=0:
                    puprint( \
                      3,z,zz,u,uu,sump,u3,u4,lo2,hi2)

            zz = z + (uu-u)
            if zz <= w:
                lo2 = abs(zz)
                hi2 =  2*w+zz-2 if zz<h-w else 2*h-zz-2
                u3 = min(uu-1,hi2)
                u4 = max(u+1,lo2)-1
                sump = accu[zz][u3] - accu[zz][u4]
                sum += sump
                if sump!=0:
                    puprint( \
                      4,z,zz,u,uu,sump,u3,u4,lo2,hi2)

print(sum)
