Robot
Toy factory, where You work, just start to make new kind of robot. Robot can sing, play, dance, talk, cry, cook, clean, wash and much more. Of course, most valuable thing he can do is movement. He can go forward, turn anticlockwise for 90° or clockwise for 90° (both turns are in place). Because of best space orientation he must know in every moment where he is. As a member of software developing team, You must determine his coordinate from his movement.
InputIn first line of standard input, You have positive numbers N, X and Y, (1 ≤ N, X, Y ≤ 1000). N is number of command which robot use for movement. X and Y are starting position coordinate in meters.
In second line are N big letters: "D", "L" or "N".
"D" means in place turn for 90° clockwise, "L" means in place turn for 90° anticlockwise, and "N" means forward movement for 1 meter. When robot start to move, he look along positive side of X axis.
In second line are N big letters: "D", "L" or "N".
"D" means in place turn for 90° clockwise, "L" means in place turn for 90° anticlockwise, and "N" means forward movement for 1 meter. When robot start to move, he look along positive side of X axis.
OutputIn first and only line at standard output, You must write two integers X and Y, separated by exactly one blank space, final position of robot.
Input:
6 2 2
NNNLNN
Output:
5 4
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.