Zid
시간 제한1초메모리 제한2048 MB
n x m 격자에서 '#' 칸을 최대 하나만 포함하는 부분 직사각형의 개수를 센다.
문제
Mr. Malnar wants to put up a picture of himself on the wall. The wall can be represented as a matrix with rows and 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 and (), the dimensions of the wall.
In each of the next lines, there are characters , 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.
힌트
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 and simultaneously.