''' The question Among the children's toys sold by Starlink, the most popular product is Bead Escape. Ball escape is a game in which red beads and blue beads are put one by one on a rectangular board, and then red beads are pulled out through a hole. The vertical size of the board is N and the horizontal size is M, and for convenience, it is divided into 1×1 compartments. The outermost rows and ..