on chessboard width 109 height 109 row number 1 109 column number leave right 1 109 therefore cell chessboard assign coordinate xy x column number y row numberevery day fight black white piece board today black one win price only rook survive drive low leave corner cell coordinate 11 but happy victory win time celebrate in order rook need home upper field cell row number 109everything fine treacherous white figure spell place field end game there type spell Vertical each define number x such spell create infinite blocking line column x x1 Horizontal each define number x_1 x_2 y such spell create block segment pass cell row y column x_1 x_2 inclusive the peculiarity spell impossible certain pair spell common point note horizontal spell common point vertical spell an example chessboard Lets recall rook chess piece point row column initial position in task rook cell r_0c_0 cell r_1c_1 condition r_1 r_0 c_1 c_0 block line block segment cell for well understanding look samplesfortunately rook remove spell tremendous effort wants remove minimum possible number spell way return home find number