#include #include using namespace std; #define nmax 105 long i, j, n, m, ma[nmax][nmax], rez; char s[nmax]; int main() { /*freopen("a.in","r",stdin); freopen("a.out","w",stdout); */scanf("%ld %ld",&n,&m); gets(s); ma[1][1]=1; rez=1; for (i=1;i<=n;i++) { gets(s); if ((i==1)&&(s[0]=='&')) ma[1][1]=rez=0; for (j=1;j<=m;j++) if ((i!=1)||(j!=1)) { if (s[j-1]=='.') { ma[i][j]=ma[i-1][j]; if (ma[i][j-1]>ma[i][j]) ma[i][j]=ma[i][j-1]; ma[i][j]++; if (ma[i][j]==1) ma[i][j]=0; if (rez