import sys
input = sys.stdin.readline

def main():
  h, w = map(int, input().split())
  s = [input().strip() for _ in range(h)]
  ld = [[0 for _ in range(2*(h+w)+w+2)] for _ in range(2*(h+w)+h+2)]  # 左上から累積
  rd = [[0 for _ in range(2*(h+w)+w+2)] for _ in range(2*(h+w)+h+2)]  # 右上から累積
  for i in range(1, 2*(h+w)+h+1):
    for j in range(1, 2*(h+w)+w+1):
      ld[i][j] += ld[i-1][j-1] + (1 if h+w <= i < h+w+h and h+w <= j < h+w+w and s[i-h-w][j-h-w] == '#' else 0)
      rd[i][j] += rd[i-1][j+1] + (1 if h+w <= i < h+w+h and h+w <= j < h+w+w and s[i-h-w][j-h-w] == '#' else 0)

  ans = 0
  for i in range(h):
    i += h+w
    for j in range(w):
      j += h+w
      for l in range(1, h + w):
        up = 1 if i - l - h - w >= 0 and s[i-h-w-l][j-h-w] == '#' else 0
        down = 1 if i + l - w - h < h and s[i-h-w+l][j-h-w] == '#' else 0
        left = 1 if j - l - h - w >= 0 and s[i-h-w][j-h-w-l] == '#' else 0
        right = 1 if j + l - w - h < w and s[i-h-w][j+l-h-w] == '#' else 0
        up_left = rd[i][j-l] - rd[i-l][j] - left
        up_right = ld[i][j+l] - ld[i-l][j] - right
        down_left = ld[i+l][j] - ld[i][j-l] - down
        down_right = rd[i+l][j] - rd[i][j+l] - down
        ans += up*left*down + up*right*down + left*up*right + left*down*right + \
          up*right*down_left + up*left*down_right + down*right*up_left + down*left*up_right
  print(ans)


if __name__ == '__main__':
  main()
