#TENKA12018E. Equilateral

Equilateral

Score : 700700 points

Problem Statement

There are some coins in the xyxy-plane. The positions of the coins are represented by a grid of characters with HH rows and WW columns. If the character at the ii-th row and jj-th column, sijs_{ij}, is #, there is one coin at point (i,j)(i,j); if that character is ., there is no coin at point (i,j)(i,j). There are no other coins in the xyxy-plane.

There is no coin at point (x,y)(x,y) where 1iH,1jW1\leq i\leq H,1\leq j\leq W does not hold. There is also no coin at point (x,y)(x,y) where xx or yy (or both) is not an integer. Additionally, two or more coins never exist at the same point.

Find the number of triples of different coins that satisfy the following condition:

  • Choosing any two of the three coins would result in the same Manhattan distance between the points where they exist.

Here, the Manhattan distance between points (x,y)(x,y) and (x,y)(x',y') is xx+yy|x-x'|+|y-y'|. Two triples are considered the same if the only difference between them is the order of the coins.

Constraints

  • 1H,W3001 \leq H,W \leq 300
  • sijs_{ij} is # or ..

Input

Input is given from Standard Input in the following format:

HH WW

s11...s1Ws_{11}...s_{1W}

::

sH1...sHWs_{H1}...s_{HW}

Output

Print the number of triples that satisfy the condition.

5 4
#.##
.##.
#...
..##
...#
3

((1,1),(1,3),(2,2)),((1,1),(2,2),(3,1))((1,1),(1,3),(2,2)),((1,1),(2,2),(3,1)) and ((1,3),(3,1),(4,4))((1,3),(3,1),(4,4)) satisfy the condition.

13 27
......#.........#.......#..
#############...#.....###..
..............#####...##...
...#######......#...#######
...#.....#.....###...#...#.
...#######....#.#.#.#.###.#
..............#.#.#...#.#..
#############.#.#.#...###..
#...........#...#...#######
#..#######..#...#...#.....#
#..#.....#..#...#...#.###.#
#..#######..#...#...#.#.#.#
#..........##...#...#.#####
870