Monster Truck

Time limit1sMemory limit128 MB

Problem

Haebin finally got his driver's license, and as a first car his parents happily bought him a monster truck. It is four times the size of an ordinary car, so it can smash through any vehicle on Gangnam Boulevard, but it is so large that parking is a real ordeal.

Jungyu happens to work part time at a public parking lot in Gangnam, so he agreed to regularly send Haebin a map of the lot. The map is a grid of R rows and C columns, where every cell is one of the following:

  • # : a building
  • X : an already-parked car
  • . : an empty parking space

Haebin's car occupies exactly a 2 by 2 block of cells. To park, he must pick one 2 by 2 block of adjacent cells inside the grid.

  • If a 2 by 2 block contains at least one building (#), he cannot park there, because even a monster truck cannot smash a building.
  • Otherwise he can park there by smashing every already-parked car (X) inside that block. The number of cars he must smash equals the number of X cells in that 2 by 2 block. (Cars he smashes on the way to the spot do not count.)

Count how many valid parking spots require smashing exactly 0, 1, 2, 3, and 4 cars.

Input

The first line contains two integers R and C separated by a space (2 ≤ R, C ≤ 50), where R is the number of rows and C is the number of columns.

Each of the next R lines contains C characters, where each character is one of #, X, or ..

Output

Print five lines.

  • Line 1: the number of spots where he can park without smashing any car.
  • Line 2: the number of spots where he parks by smashing exactly 1 car.
  • Line 3: the number of spots where he parks by smashing exactly 2 cars.
  • Line 4: the number of spots where he parks by smashing exactly 3 cars.
  • Line 5: the number of spots where he parks by smashing exactly 4 cars.