Consider a room of size H*W (3<=H < 10000,3<=W < 10000) in which its four walls are covered by mirrors. You need to simulate the laser beam reflection in the room and print out the k-th ( 0 < k < 10000)reflection point.
We assume that the laser beam is always emitted from the left mirror and moves in the upper-right direction at an angle of 45 degrees. More specifically, the starting point can be represented by (r, 1) where 1<r<H. The laser beam will stop if it hits any corner of the room. Also, each point can only reflect the laser beam once. That is, the second time the laser beam hits the same point, the process of reflection stops.
For example, if the room size is 5*5 and the laser beam starts at (3,1), then the first point it hits is (3,1), the second point is (1,3), the third point is (3,5), and so on. If k=3 you need to print out (3,5).
If the laser beam stop before the k-th reflection, you need to print out coordinate of the stop point. For example, if k =10 and the first point is (3,1), you need to print out (3,1) because the laser beam stops at (3,1).
The first line is the height and width of the room.
The second line is the starting point (the first reflection point).
The third line is k, which means you need to print out the k-th reflection point.
The coordinate of the k-th reflection point.
Note that you DO NOT need to print a newline character ‘\n’ at the end of the output.