408749: GYM103294 D Cornfield Chase

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Cornfield Chasetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Superbman is escaping from his archrival Rex Ruthor's hideout and is pursued into a large cornfield of size $$$n$$$ meters by $$$m$$$ meters. Each square meter of the cornfield is either filled with thick and tall corn stalks (noted by a '*' on the grid) or is empty (noted by '.'). Superbman is running low on energy though and needs to begin his evasive maneuver quickly.

From recent memory, he has found that Rex tends to be lost whenever he makes sharp turns so he decides to make a right triangle with his flight path in order to completely bamboozle Rex. However, he wants to make the three turns (corresponding to the vertices of the triangle) in only the squares which contain the corn stalks. Additionally, Superbman doesn't like flying diagonally so he wants two of the sides of the triangle made by his flight path to be parallel to the sides of the square.

Given Superbman's complicated escape maneuver plan, help Superbman find the number of triangles that can be made on the cornfield which fit his specifications.

Input

The first line of input will be two space-separated integers $$$n$$$ and $$$m$$$ where $$$1 \leq n,m \leq 500$$$ and $$$n$$$ is the number of rows in the cornfield and $$$m$$$ is the number of columns.

The following $$$n$$$ lines will each contain $$$m$$$ characters (the only two possible characters are '*' and '.') to describe the field.

Output

Output a single integer, the number of triangles that satisfy Superbman's escape maneuver plan.

ExamplesInput
2 2
**
*.
Output
1
Input
3 2
.*
*.
.*
Output
0

加入题单

上一题 下一题 算法标签: