Red and Black#7024

Red and Black

1 second
122.174 megabytes
Easy

There is a rectangular room covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From his current tile, he can move to one of the four adjacent tiles (up, down, left, or right), but he cannot step on red tiles—he may move only on black tiles.

Write a program to count the number of black tiles he can reach by making moves as described above.

Input

The input consists of multiple data sets. Each data set starts with a line containing two positive integers and (1 \leq w, h \leq 20) — the number of tiles in the - and -directions, respectively.

Each of the next lines contains characters, each representing the color of a tile as follows:

  • . — a black tile

  • # — a red tile

  • @ — the man on a black tile (appears exactly once in each data set)

The end of the input is indicated by a line containing two zeros.

Output

For each data set, output a line containing the number of black tiles that the man can reach from his initial position (including the starting tile itself).

Examples

Example 1

Loading
Loading