#include using namespace std; struct coada { int x,y;}; int a[102][102],b[102][102]; coada c[10002]; int main() { /*freopen("date.in","r",stdin); freopen("date.out","w",stdout);*/ char ch; int n,m,i,j,p,u,x,y; scanf("%d%d",&n,&m); scanf("%c",&ch); for(i=1;i<=n;i++){for(j=1;j<=m;j++) { scanf("%c",&ch); if(ch=='.')a[i][j]=1;} scanf("%c",&ch); } //for(i=1;i<=n;i++){for(j=1;j<=m;j++)printf("%d ",a[i][j]); printf("\n");} //LEE: if(a[1][1]==0){ printf("0"); return 0; } p=u=1; c[p].x=1; c[p].y=1; b[1][1]=1; long long maxim=1; while(p<=u){ x=c[p].x; y=c[p].y; if(a[x+1][y]==1){b[x+1][y]=b[x][y]+1; u++; c[u].x=x+1; c[u].y=y; if(b[x+1][y]>maxim)maxim=b[x+1][y];} if(a[x][y+1]==1){b[x][y+1]=b[x][y]+1; u++; c[u].x=x; c[u].y=y+1; if(b[x][y+1]>maxim)maxim=b[x][y+1];} p++; } printf("%d",maxim); return 0; }