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 a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles.

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



Input

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

There are H more lines in the data set, each of which includes W characters. Each character represents the color of a tile as follows.

* '.' - a black tile
* '#' - a red tile
* '@' - a man on a black tile(appears exactly once in a data set)


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

Output

For each data set, your program should output a line which contains the number of tiles he can reach from the initial tile (including itself).

Examples

Input

6 9
....#.
.....#
......
......
......
......
......
#@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
..#.#..
..#.#..
###.###
...@...
###.###
..#.#..
..#.#..
0 0


Output

45
59
6
13


Input

6 9
....#.
.....#
......
......
......
......
......
@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
..#.#..
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0


Output

45
59
6
13
def dfs(now,origin,drawn): # 深さ優先探索　再帰関数　originは変更しない　drawnは訪れた場所に1それ以外は0
    positive = '.' # 進める場所
    negative = '#' # 進めない場所(壁)
    direct = [0,0,0,0] # [上,下,左,右]を表す
    height = len(origin)
    width = len(origin[0])
    now_h = now[0]
    now_w = now[1]
    ### それぞれの方向について、originにおいてpositiveかつdrawnにおいて0（つまり訪れたことがある）なら進める
    if now_h != 0 and origin[now_h-1][now_w] == positive and drawn[now_h-1][now_w] == 0:
        direct[0] = 1
    if now_h != height-1 and origin[now_h+1][now_w] == positive and drawn[now_h+1][now_w] == 0:
        direct[1] = 1
    if now_w != 0 and origin[now_h][now_w-1] == positive and drawn[now_h][now_w-1] == 0:
        direct[2] = 1
    if now_w != width-1 and origin[now_h][now_w+1] == positive and drawn[now_h][now_w+1] == 0:
        direct[3] = 1

    if sum(direct) == 0: # 進む先がなければ終了
        return 0
    d = {0:[now_h-1,now_w],1:[now_h+1,now_w],2:[now_h,now_w-1],3:[now_h,now_w+1]} # 進む先の座標を辞書にしておく
    for i in range(4):
        if direct[i] == 1:
            drawn[d[i][0]][d[i][1]] = 1 # d[i]の座標に移動したのでdrawnで訪れたことを記録した
            dfs(d[i],origin,drawn) # 再帰
    return 0

while True:
    W, H = map(int,input().split()) # 入力を受け取る
    if W == 0 and H == 0: # 両方0だったらbreak
        break
    tiles = [list(input()) for i in range(H)] # 入力
    possible_tiles = [[0 for i in range(W)] for j in range(H)] # 訪れたことがある場所を記憶する
    for h in range(H):
        for w in range(W):
            if tiles[h][w] == '@': # 現在地
                now = [h,w]
                break
    possible_tiles[now[0]][now[1]] = 1 # 現在地は既に訪れている
    dfs(now,tiles,possible_tiles) # 探索
    ans = 0
    for h in range(H):
        for w in range(W):
            if possible_tiles[h][w] == 1:
                ans += 1
    print(ans)
