//简单的的搜索,找到能扩充的最大步数
#include<iostream>
using namespace std;
const int maxn = 20 + 5;
int dirx[4] = {0, 0, -1, 1};
int diry[4] =
{-1, 1, 0, 0};
int n, m, ans;
int sx, sy;
char map[maxn][maxn];
bool
used[maxn][maxn];
int dfs(int x, int y){
int px, py;
int max = 0;
used[x][y] =
1;
ans++;
for(int i=0; i<4; i++){
px = dirx[i] + x;
py =
diry[i] + y;
if(!used[px][py] && map[px][py] != ‘#‘ && px
>= 1 && px <= m && py >= 1 && py <=
n){
dfs(px, py);
}
}
return ans;
}
int main(){
while(scanf("%d%d", &n, &m) != EOF){
if(n == 0
&& m == 0)
break;
memset(map, ‘#‘, sizeof(map));
ans =
0;
getchar();
for(int i=1; i<=m; i++){
for(int j=1; j<=n;
j++){
scanf("%c", &map[i][j]);
if(map[i][j] ==
‘@‘){
sx = i;
sy =
j;
}
}
getchar();
}
memset(used, 0,
sizeof(used));
ans = 0;
int sum = dfs(sx,
sy);
cout<<sum<<endl;
}
return 0;
}