Consider a room of size H*W (3<=H,3<=W) in which its four walls are covered by mirrors. You need to simulate the light reflection in the room and print out the k-th reflection point.
We assume that the light 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 light will stop if it hits any corner of the room .
For example, if the room size is 5*6 and the light starts at (3,1), then the first point it hits is (3,1), the second point is (1,3), the third point is (4,6), and so on. If k=3 you need to print out (4,6).
If the light hits a corner before the k-th reflection, you need to print out coordinate of that corner. For example, if k =10 and the first point is (3,1), you need to print out (1,1) because the light stops at (1,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.