#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int w,h,ans,x,y;
char a[30][30];
int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0},f[30][30];
int dfs(int x,int y)
{
int xx,yy;
ans++;
f[x][y]=1;
for (int i=0;i<4;i++)
{
xx=x+dx[i];
yy=y+dy[i];
if ((xx>0)&&(xx<=h)&&(yy>0)&&(yy<=w)&&(a[xx][yy]==‘.‘)&&(!f[xx][yy]))//超看是否越界,是否是黑砖,是否走过
dfs(xx,yy);
}
}
int main()
{
scanf("%d%d",&w,&h);
while (w&&h)
{
ans=0;
memset(f,0,sizeof(f));
for (int i=1;i<=h;i++)
for (int j=1;j<=w;j++)
{
cin>>a[i][j];
if (a[i][j]==‘@‘)
{
x=i;//注意不要将x代表纵坐标,y代表横坐标,不要弄混!!!
y=j;
a[i][j]=‘.‘;
}
}
dfs(x,y);
printf("%d\n",ans);
scanf("%d%d",&w,&h);
}
}