#include#include char str[22][22];int temp[22][22];int cnt,h,w;void dfs(int x,int y){ cnt ++; temp[x][y] = 1; if(!temp[x+1][y]&& x+1 < w) dfs(x+1,y); if(!temp[x-1][y] && x-1 > -1) dfs(x-1,y); if(!temp[x][y+1] && y+1 < h) dfs(x,y+1); if(!temp[x][y-1] && y-1 > -1) dfs(x,y-1);}int main(){ int i,j,a,b; while(~scanf("%d%d",&h,&w)&&h+w) { cnt = 0; for(i = 0;i < w;i ++) { scanf("%s",str[i]); for(j = 0;j < h;j ++) { if(str[i][j] == '#') temp[i][j] = 1; if(str[i][j] == '.') temp[i][j] = 0; if(str[i][j] == '@') { a = i; b = j; } } } dfs(a,b); printf("%d\n",cnt); } return 0;}