Binbin is a clever boy who likes to wear a skirt. One day, he saw some beautiful skirts on Taobao, but he had not enough money, which made him sad.
In order to make Binbin feel happy again, his's friend Xu1024 gave him a treasure map. The treasure map is composed of three characters: '.', '#', '$'.
Character '.' indicates that this position is empty and passable;
Character '#' indicates that this position is blocked by a stone and not passable;
Character '$' indicates that this position has 1 coin on it and is passablle.
The locations outside the treasure map are all empty and passable.
Because Binbin wanted to wear a skirt so much, he had a chance to teleport to a certain grid as another starting point.
Binbin wanted to know how many coins he could eventually collect to buy skirts.
Can you help him?The first line of each group contains two numbers N and M,(1<=N, M<=500), representing the number of rows and the number of columns of treasure map.
Then there are next N lines, each line contains M characters. which describe the terasure map.
Ouput a integer representing
the maxinum money Binbin would collected.