Contest Duration: ~ (local time) (100 minutes) Back to Home
B - Futon /

Time Limit: 2 sec / Memory Limit: 1024 MB

問題文

H 行、横 W 列からなるマス目があり、それぞれのマスは散らかっているか散らかっていないかのどちらかです。

制約

• 2 \leq H \leq 100
• 2 \leq W \leq 100
• S_i.# のみからなる長さ W の文字列

入力

H W
S_1
:
S_H


入力例 1

2 3
..#
#..


出力例 1

3


• 上から 1 行目の左から 1 列目と 2 列目
• 上から 2 行目の左から 2 列目と 3 列目
• 左から 2 列目の上から 1 行目と 2 行目

入力例 2

2 2
.#
#.


出力例 2

0


Score : 200 points

Problem Statement

We have a grid with H horizontal rows and W vertical columns of squares, where each square is tidy or untidy.

You will now place a mattress on this grid.

The mattress can be placed on two horizontally or vertically adjacent tidy squares in the grid.

Given are integers H, W, and H strings S_i of length W each. If the j-th character of S_i is ., the square at the i-th row from the top and the j-th column from the left is tidy; if the j-th character of S_i is #, the square at the i-th row from the top and the j-th column from the left is untidy.

Find the number of ways to choose the position for the mattress.

Constraints

• 2 \leq H \leq 100
• 2 \leq W \leq 100
• S_i is a string of length W consisting of . and #.

Input

Input is given from Standard Input in the following format:

H W
S_1
:
S_H


Output

Print the number of ways to choose the position for the mattress.

Sample Input 1

2 3
..#
#..


Sample Output 1

3


We have the following three choices:

• the 1-st and 2-nd squares from the left in the 1-st row from the top;
• the 2-nd and 3-rd squares from the left in the 2-nd row from the top; and
• the 1-st and 2-nd squares from the top in the 2-nd column the left.

Sample Input 2

2 2
.#
#.


Sample Output 2

0