Preparando MOJI
On a certain meeting of a ruling party "A" minister Pavel suggested to improve the sewer system and to create a new pipe in the city.
The city is an n × m rectangular squared field. Each square of the field is either empty (then the pipe can go in it), or occupied (the pipe cannot go in such square). Empty squares are denoted by character '.', occupied squares are denoted by character '#'.
The pipe must meet the following criteria:
Here are some samples of allowed piping routes:
....# ....# .*..#
***** ****. .***.
..#.. ..#*. ..#*.
#...# #..*# #..*#
..... ...*. ...*.
Here are some samples of forbidden piping routes:
.**.# *...# .*.*#
..... ****. .*.*.
..#.. ..#*. .*#*.
#...# #..*# #*.*#
..... ...*. .***.
In these samples the pipes are represented by characters ' * '.
You were asked to write a program that calculates the number of distinct ways to make exactly one pipe in the city.
The two ways to make a pipe are considered distinct if they are distinct in at least one square.
The first line of the input contains two integers n, m (2 ≤ n, m ≤ 2000) — the height and width of Berland map.
Each of the next n lines contains m characters — the map of the city.
If the square of the map is marked by character '.', then the square is empty and the pipe can through it.
If the square of the map is marked by character '#', then the square is full and the pipe can't through it.
In the first line of the output print a single integer — the number of distinct ways to create a pipe.
3 3
...
..#
...
3
4 2
..
..
..
..
2
4 5
#...#
#...#
###.#
###.#
4
In the first sample there are 3 ways to make a pipe (the squares of the pipe are marked by characters ' * '):
.*. .*. ...
.*# **# **#
.*. ... .*.