Elephant show#2537

Elephant show

1 second
64 megabytes
Easy

There are a lot of elephants in Chiang Mai, and many elephant camps can be seen around this city. Elephant camps are among the most popular attractions in Chiang Mai, but Khun-Lung-Ken Elephant Farm is very different from the others.

At Khun-Lung-Ken Elephant Farm, you can enjoy shows performed by elephants such as dancing, playing football, and painting. But the most interesting show is when an elephant eats apples on the ground at high speed. This show is held on a rectangular field, which is covered with large square tiles. Each tile is colored either red or yellow, and each tile has an apple placed on it. At first, an elephant stands on a yellow tile. From this tile, he can move to one of four adjacent tiles. However, he can only move horizontally or vertically. He will not move onto red tiles; he will only move onto yellow tiles in order to get an apple, and never pick up an apple placed on a red tile.

Write a program to count the number of apples the elephant can eat by repeating the moves described above.

Input

The input consists of multiple data sets. Each data set starts with a line containing two positive integers and ; and are the numbers of tiles in the - and -directions, respectively. and are not more than .

There are lines in each data set, each of which contains characters. Each character represents the color of a tile as follows:

  • a yellow tile

  • \texttt{#} a red tile

  • an elephant on a yellow tile (appears once in the data set)

The end of input is indicated when both and are zero.

Output

For each data set, your program should output a single line containing the number of tiles the elephant can reach from the initial tile (including this tile).

Examples

Example 1

Loading
Loading