#include #include int n,m; char a[100][100]; int going_in(x,y) { if ((x==n-1) && (y==m-1)) { return 1; } else if (x==n-1) { if (a[x][y+1]=='&') { return 1; } else { return 1+going_in(x,y+1); } } else if (y==m-1) { if (a[x+1][y]=='&') { return 1; } else { return 1+going_in(x+1,y); } } else { if ((a[x+1][y]=='&') && (a[x][y+1]=='&')) { return 1; } else if (a[x+1][y]=='&') { return 1+going_in(x,y+1); } else if (a[x][y+1]=='&') { return 1+going_in(x+1,y); } else { int nr1=going_in(x+1,y); int nr2=going_in(x,y+1); if (nr1>nr2) { return 1+nr1; } else { return 1+nr2; } } } } int main() { scanf("%d %d",&n,&m); int i,j; for (i=0;i