~/algor $ cat problems/case-robot-qadami
Robot steps
Easy
1000 ms
64 MB
23%
A robot stands at the point $(x; y)$ of the coordinate plane and walks $n$ steps in direction $c$. Directions: s — north (each step increases $y$ by $1$), j — south ($y$ decreases by $1$), q — east ($x$ increases by $1$), g — west ($x$ decreases by $1$). Find the coordinates of the point where the robot stops.
Input
One line with four items: integers $x$ and $y$, a direction letter $c$ (s, j, q or g) and an integer $n$.
Output
One line with two integers: the $x$ and $y$ coordinates of the point where the robot stops.
Note
$-1000 \le x, y \le 1000$
$0 \le n \le 1000$
Examples
Input #1
2 1 s 3
Output #1
2 4
Input #2
0 0 g 5
Output #2
-5 0