import sys
input = sys.stdin.readline

class CumulativeSum2D:
    def __init__(self, field):
        self.h = len(field)
        self.w = len(field[0])
        self.h_offset = self.h
        self.w_offset = self.w
        self.field = field
        self.cumsum = [[0] * (self.w + self.w_offset * 2) for _ in range(self.h_offset)]
        for line in self.field:
            self.cumsum.append([0] * self.w_offset + line + [0] * self.w_offset)
        for i in range(self.h_offset):
            self.cumsum.append([0] * (self.w + self.w_offset * 2))
    
    def calc_horizontal_cumsum(self):
        # Calc horizontal cumlative sum
        for i in range(self.h_offset, self.h_offset + self.h):
            for j in range(self.w_offset, self.w_offset + self.w):
                self.cumsum[i][j] += self.cumsum[i][j-1]
        # Calc vertical cumlative sum
        for i in range(self.w_offset, self.w_offset + self.w):
            for j in range(self.h_offset, self.h_offset + self.h):
                self.cumsum[j][i] += self.cumsum[j-1][i]

    def calc_diagonal_cumsum(self):
        # Calc ul to dr
        for h in range(self.h_offset, self.h_offset + self.h):
            delta = 1
            while delta + h < self.h_offset * 2 + self.h and self.w_offset + delta < self.w_offset * 2 + self.w:
                self.cumsum[h + delta][self.w_offset + delta] += self.cumsum[h + delta-1][self.w_offset + delta-1]
                delta += 1
        for w in range(self.w_offset + 1, self.w_offset + self.w):
            delta = 1
            while delta + w < self.w_offset * 2 + self.w and self.h_offset + delta < self.h_offset * 2 + self.h:
                self.cumsum[self.h_offset + delta][w + delta] += self.cumsum[self.h_offset + delta - 1][w + delta - 1]
                delta += 1
        # Calc ur to dl
        for h in range(self.h_offset * 2 + self.h - 1, - 1, -1):
            delta = 1
            while delta + h < self.h_offset * 2 + self.h and self.w_offset * 2 + self.w - 1 - delta >= 0:
                self.cumsum[h + delta][self.w_offset * 2 + self.w - 1 - delta] += self.cumsum[h + delta - 1][self.w_offset * 2 + self.w - 1 - delta + 1]
                delta += 1
        for w in range(self.w_offset * 2 + self.w - 2, -1, -1):
            delta = 1
            while w - delta >= 0 and delta < self.h_offset * 2 + self.h:
                self.cumsum[delta][w - delta] += self.cumsum[delta - 1][w - delta + 1]
                delta += 1
    
    # Get horizontal sum in l <= x < r, u <= y < d
    # x: right, y: down
    def get_horizontal_sum(self, x1, y1, x2, y2):
        ret = self.cumsum[y2-1 + self.h_offset][x2-1 + self.w_offset]
        ret -= self.cumsum[y2-1 + self.h_offset][x1-1 + self.w_offset]
        ret -= self.cumsum[y1-1 + self.h_offset][x2-1 + self.w_offset]
        ret += self.cumsum[y1-1 + self.h_offset][x1-1 + self.w_offset]
        return ret
    
    # Get horizontal sum in x1 <= x <= x2, y1 <= y <= y2 
    def get_diagonal_sum(self, x1, y1, x2, y2):
        if ((x1 + y1) - (x2 + y2)) % 2 == 1:
            return None
        u2 = x2 + y2 
        v2 = x2 - y2
        u1 = x1 + (y1 - 2)
        v1 = x1 - (y1 - 2)
        x3 = (u2 + v1) // 2
        y3 = (u2 - v1) // 2
        x4 = (u1 + v2) // 2
        y4 = (u1 - v2) // 2
        ret = self.cumsum[y2 + self.h_offset][x2 + self.w_offset]
        ret -= self.cumsum[y3 + self.h_offset][x3 + self.w_offset]
        ret -= self.cumsum[y4 + self.h_offset][x4 + self.w_offset]
        ret += self.cumsum[y1-2 + self.h_offset][x1 + self.w_offset]
        return ret
        

    def print(self):
        print("h:", self.h, "w:", self.w)
        for i in range(self.h_offset, self.h_offset + self.h):
            print(self.cumsum[i][self.w_offset:self.w_offset + self.w])

if __name__ == "__main__":
    n, m = [int(item) for item in input().split()]
    field_lu = [[0] * m for _ in range(n)]
    field_ru = [[0] * n for _ in range(m)]
    for i in range(n):
        line = input().rstrip()
        for j in range(m):
            if line[j] == "#":
                field_lu[i][j] = 1
                field_ru[m-1-j][i] = 1

    cs_lu = CumulativeSum2D(field_lu)
    cs_lu.calc_diagonal_cumsum()

    lu_to_rd = [[] for _ in range(n + m - 1)]
    for i in range(m):
        x = i; y = 0
        delta = 0
        while x + delta < m and y + delta < n: 
            if field_lu[y + delta][x + delta] == 1:
                lu_to_rd[i].append((x + delta, y + delta))
            delta += 1
    for i in range(1, n):
        x = 0; y = i
        delta = 0
        while x + delta < m and y + delta < n:
            if field_lu[y + delta][x + delta] == 1:
                lu_to_rd[i + m - 1].append((x + delta, y + delta))
            delta += 1

    ans = 0
    double = 0
    for line in lu_to_rd:
        length = len(line)
        if length <= 1:
            continue
        for i in range(length):
            for j in range(i+1, length):
                x1 = line[i][0]
                y1 = line[i][1]
                x2 = line[j][0]
                y2 = line[j][1]
                d = abs(x1 - x2)
                # Proc upper
                x3 = x1 + d
                y3 = y1 - d
                x4 = x2 + d
                y4 = y2 - d
                if 0 <= x3 < m and 0 <= y3 < n and field_lu[y3][x3] == 1:
                    double += 1
                if 0 <= x4 < m and 0 <= y4 < n and field_lu[y4][x4] == 1:
                    double += 1
                ans += cs_lu.get_diagonal_sum(x3, y3, x4, y4)
                # Proc lower
                x3 = x1 - d
                y3 = y1 + d
                x4 = x2 - d
                y4 = y2 + d
                if 0 <= x3 < m and 0 <= y3 < n and field_lu[y3][x3] == 1:
                    double += 1
                if 0 <= x4 < m and 0 <= y4 < n and field_lu[y4][x4] == 1:
                    double += 1
                ans += cs_lu.get_diagonal_sum(x3, y3, x4, y4)

    cs_ru = CumulativeSum2D(field_ru)
    cs_ru.calc_diagonal_cumsum()
    lu_to_rd = [[] for _ in range(n + m - 1)]
    for i in range(n):
        x = i; y = 0
        delta = 0
        while x + delta < n and y + delta < m: 
            if field_ru[y + delta][x + delta] == 1:
                lu_to_rd[i].append((x + delta, y + delta))
            delta += 1
    for i in range(1, m):
        x = 0; y = i
        delta = 0
        while x + delta < n and y + delta < m:
            if field_ru[y + delta][x + delta] == 1:
                lu_to_rd[i + n - 1].append((x + delta, y + delta))
            delta += 1
    for line in lu_to_rd:
        length = len(line)
        if length <= 1:
            continue
        for i in range(length):
            for j in range(i+1, length):
                x1 = line[i][0]
                y1 = line[i][1]
                x2 = line[j][0]
                y2 = line[j][1]
                d = abs(x1 - x2)
                # Proc upper
                x3 = x1 + d
                y3 = y1 - d
                x4 = x2 + d
                y4 = y2 - d
                if 0 <= x3 < n and 0 <= y3 < m and field_ru[y3][x3] == 1:
                    double += 1
                if 0 <= x4 < n and 0 <= y4 < m and field_ru[y4][x4] == 1:
                    double += 1
                ans += cs_ru.get_diagonal_sum(x3, y3, x4, y4)
                # Proc lower
                x3 = x1 - d
                y3 = y1 + d
                x4 = x2 - d
                y4 = y2 + d
                if 0 <= x3 < n and 0 <= y3 < m and field_ru[y3][x3] == 1:
                    double += 1
                if 0 <= x4 < n and 0 <= y4 < m and field_ru[y4][x4] == 1:
                    double += 1
                ans += cs_ru.get_diagonal_sum(x3, y3, x4, y4)

    print(ans - double // 2)