cho.sh
Notes
Loading...

Floor Decoration

Time limit

2s

Memory limit

128 MB

Problem

Hyeongtaek is an architect who designed the floor decoration for Gihoon's room. The floor is a rectangle divided into square cells parallel to the walls, and each cell contains either - or |.

Each wooden plank has width 1 and a positive integer length. Adjacent - cells in the same row belong to one horizontal plank. Adjacent | cells in the same column belong to one vertical plank.

Given the floor pattern, determine how many wooden planks are needed.

Input

The first line contains two natural numbers N and M, the height and width of the floor.

Each of the next N lines contains a string of length M. These strings describe the floor pattern and consist only of - and |.

Both N and M are at most 50.

Output

Print the number of wooden planks needed.