#include<iostream>usingnamespace std;char a[105][105], v[105][105];int n, m;voiddfs(int x,int y){if(x <0|| y <0|| x >= n || y >= m)return;if(a[x][y]=='*'|| v[x][y])return;
v[x][y]=1;dfs(x -1, y -1);dfs(x -1, y);dfs(x -1, y +1);dfs(x, y -1);dfs(x, y +1);dfs(x +1, y -1);dfs(x +1, y);dfs(x +1, y +1);}intmain(){while(cin >> n >> m &&(m !=0&& n !=0)){memset(v,0,sizeof(v));memset(a,0,sizeof(a));for(int i =0; i < n; i++)for(int j =0; j < m; j++)
cin >> a[i][j];int cnt =0;for(int i =0; i < n; i++){for(int j =0; j < m; j++){if(a[i][j]=='@'&&!v[i][j]){dfs(i, j);
cnt++;}}}printf("%d\n", cnt);}return0;}