eolymp
bolt
Try our new interface for solving problems

Weed

Time limit 1 second
Memory limit 128 MiB

Andrew has visited his garden for the last time many years ago. Today's property taxes are so high, so Andrew decided to sell his garden. The land was not cultivated for a long time and now it is probably a lot of weed on it. Andrew wants to remove everything from the ground before selling. Now he wants to estimate the amount of work.

The garden has the rectangular form and is divided into n * m equal squares. Andrew's memory is phenomenal. He remembers which squares were occupied by the weed. For the purpose of simplicity, Andrew thinks that each square is either fully occupied by the weed or completely free from it. Andrew likes botany and he knows that if some square is free from the weed but at least two of its adjacent squares are occupied by the weed (two squares are adjacent if they have common side), that square will be also occupied by the weed soon. Andrew is pretty sure that during last years weed occupied every square possible. Please help Andrew to estimate how many squares is occupied by the weed.

Input data

The first line contains integers n and m (1n, m1000). Next n lines contain m characters each. Character X denotes that the corresponding square is occupied by the weed. A period character ( . ) denotes an empty square.

Output data

Print one integer denoting the number of squares occupied by the weed after so many years.

Examples

Input example #1
3 3
X..
.X.
.X.
Output example #1
6
Input example #2
3 4
X..X
.X..
.X..
Output example #2
12
Source 2007 Петрозаводск, Saratov for Karelia with love, Январь 28, Задача H