#include<bits/stdc++.h>
using namespace std;
int n,m;bool t[100][100];char a[100][100];
int f(int y,int x)
{int e=0;
if (t[y+1][x]==0&&a[y+1][x]=='.')
{e+=1;t[y+1][x]=1;e+=f(y+1,x);}
if (t[y-1][x]==0&&a[y-1][x]=='.')
{e+=1;t[y-1][x]=1;e+=f(y-1,x);}
if (t[y][x+1]==0&&a[y][x+1]=='.')
{e+=1;t[y][x+1]=1;e+=f(y,x+1);}
if (t[y][x-1]==0&&a[y][x-1]=='.')
{e+=1;t[y][x-1]=1;e+=f(y,x-1);}
return e;}
int main()
{int w,b,c;
cin>>n>>m;
for (int i=1;i<=n;i++)
{for (int j=1;j<=m;j++)
{cin>>a[i][j];
if (a[i][j]=='@')
{b=i;c=j;}}}
t[b][c]=1;
cout<<f(b,c)+1;
return 0;}