### BUGGY CODE ###

H, W = map(int, input().split())
X = [[[0, 1][a=="#"] for a in input()] for i in range(H)]
def countRD(n, i, j):
    return ccc(n, i, j, 1, 1)
def countRU(n, i, j):
    return ccc(n, i, j, -1, 1)
def countLD(n, i, j):
    return ccc(n, i, j, 1, -1)
def countLU(n, i, j):
    return ccc(n, i, j, -1, -1)
def countR(n, i, j):
    return cc(n, i, j, 0, 1)
def countL(n, i, j):
    return cc(n, i, j, 0, -1)
def countD(n, i, j):
    return cc(n, i, j, 1, 0)
def countU(n, i, j):
    return cc(n, i, j, -1, 0)
def ccc(n, i, j, DU, RL):
    c = 0
    for k in range(1, n):
        if i+k*DU >= 0 and i+k*DU < H:
            if j+(n-k)*RL >= 0 and j+(n-k)*RL < W:
                c += X[i+k*DU][j+(n-k)*RL]
    return c
def cc(n, i, j, DU, RL):
    ret = 0
    if i+n*DU >= 0 and i+n*DU < H:
        if j+n*RL >= 0 and j+n*RL < W:
            ret = X[i+n*DU][j+n*RL]
    return ret

ans = 0
for i in range(H):
    for j in range(W):
        for n in range(1, min(i+j, H-i, W-j)+2):
            if countR(n, i, j) and countD(n, i, j):
                ans += countLU(n, i, j)
for i in range(H):
    for j in range(W):
        for n in range(1, min(i, W-j, H-i+j)+2):
            if countR(n, i, j) and countU(n, i, j):
                ans += countLD(n, i, j)
for i in range(H):
    for j in range(W):
        for n in range(1, min(i+W-j, H-i, j)+2):
            if countL(n, i, j) and countD(n, i, j):
                ans += countRU(n, i, j)
for i in range(H):
    for j in range(W):
        for n in range(1, min(i, j, H-i + W-j)+2):
            if countL(n, i, j) and countU(n, i, j):
                ans += countRD(n, i, j)
for i in range(H):
    for j in range(W):
        for n in range(1, max(H, W)):
            if countR(n, i, j) and countD(n, i, j) and countL(n, i, j):
                ans += 1
for i in range(H):
    for j in range(W):
        for n in range(1, max(H, W)):
            if countR(n, i, j) and countD(n, i, j) and countU(n, i, j):
                ans += 1
for i in range(H):
    for j in range(W):
        for n in range(1, max(H, W)):
            if countR(n, i, j) and countU(n, i, j) and countL(n, i, j):
                ans += 1
for i in range(H):
    for j in range(W):
        for n in range(1, max(H, W)):
            if countD(n, i, j) and countU(n, i, j) and countL(n, i, j):
                ans += 1
            
            
print (ans)





### FIXED CODE ###

H, W = map(int, input().split())
I = [input() for _ in range(H)]
X = [[[0, 1][a=="#"] for a in inp] for inp in I]
k = 32
def r():
    global H, W, I
    I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)]
    H, W = W, H
def st1(s):
    return int(s.replace("#", "1" * k).replace(".", "0" * k), 2)
def st2(s):
    return int(s.replace("#", "0" * (k - 1) + "1").replace(".", "0" * k), 2)
def getsum(x):
    for i in range(8):
        x += x >> (k << i)
    return x & ((1 << k) - 1)

ans = 0
for _ in range(4):
    A1 = [st1(inp) for inp in I]
    A2 = [st1("".join([I[i][j] for i in range(H)])) for j in range(W)]
    B = [st2(inp[::-1]) for i, inp in enumerate(I)]
    C = [[0] * W for _ in range(H)]
    for j in range(W):
        s = 0
        m = (1 << j * k) - 1
        for i in range(H)[::-1]:
            s <<= k
            s += B[i] >> (j+1) * k
            s &= m
            C[i][j] = s
    for i in range(1, H):
        for j in range(1, W):
            ans += A1[i] >> (W - j) * k & A2[j] >> (H - i) * k & C[i][j]
    r()
            
print(getsum(ans))