시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB117777.778%

문제

Mr. Malnar wants to put up a picture of himself on the wall. The wall can be represented as a matrix with $n$ rows and $m$ columns. Since he has placed his picture on the wall many times before, some positions still have nails embedded in them. Such positions are marked with the symbol "#", while empty spots are marked with the symbol ".".

The picture has a rectangular shape with arbitrary dimensions and is placed on the wall in a way that it covers a rectangular area. The picture can be placed on the wall if it covers at most one position that contains a nail.

Help Mr. Malnar calculate the number of ways he can place his picture on the wall.

입력

The first line of input contains $n$ and $m$ ($1 ≤ n, m ≤ 500$), the dimensions of the wall.

In each of the next $n$ lines, there are $m$ characters $c_{ij}$, describing the wall. Each character will be either "." or "#" (without quotes).

출력

In a single line of output, print the number of possible ways to place the picture on the wall.

서브태스크

번호배점제한
117

$n, m ≤ 10$

221

$n, m ≤ 100$

332

No additional constraints.

예제 입력 1

3 3
...
...
..#

예제 출력 1

36

예제 입력 2

4 4
....
.#..
#...
#.#.

예제 출력 2

76

예제 입력 3

5 5
.....
#..#.
..#.#
.....
..#..

예제 출력 3

154

힌트

Clarification of the first example: Each placement of the picture is valid as long as it covers at most one nail.

Clarification of the second example: The picture cannot be placed in a way that it covers positions $(3, 1)$ and $(4, 1)$ simultaneously.

채점 및 기타 정보

  • 예제는 채점하지 않는다.