#include<stdio.h>
#include<string.h>

int count(int x,int y);

char board[20][22];

int main(void){
    int w,h,i,j;
    while(scanf("%d%d%*c",&w,&h) && w && h){
        for(i=0;i<h;i++) for(j=0;j<w;j++) board[i][j]=0;
        for(i=0;i<h;i++){
            fgets(board[i],sizeof(board[i]),stdin);
        }
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                if(board[i][j]=='@')
                    break;
            }
            if(j<w) break;
        }
        printf("%d\n",count(i,j));
    }
    return 0;
}

int count(int x,int y){
    int ret=1;
    if(x!=0 && board[x-1][y]=='.'){
        board[x-1][y]='@';
        ret+=count(x-1,y);
    }
    if(y!=0 && board[x][y-1]=='.'){
        board[x][y-1]='@';
        ret+=count(x,y-1);
    }
    if(x<20 && board[x+1][y]=='.'){
        board[x+1][y]='@';
        ret+=count(x+1,y);
    }
    if(y<22 && board[x][y+1]=='.'){
        board[x][y+1]='@';
        ret+=count(x,y+1);
    }
    return ret;
}