A robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of nn rows and mm columns. The rows of the floor are numbered from 1 to n from top to bottom, and columns of the floor are numbered from 1 to m from left to right. The cell on the intersection of the rr-th row and the cc-th column is denoted as (r,c). The initial position of the robot is (rb,cb).
In one second, the robot moves by drdr rows and dcdc columns, that is, after one second, the robot moves from the cell (r,c) to (r+dr,c+dc). Initially dr=1, dc=1. If there is a vertical wall (the left or the right walls) in the movement direction, dcdc is reflected before the movement, so the new value of dcdc is −dc. And if there is a horizontal wall (the upper or lower walls), dr is reflected before the movement, so