~/algor $ cat problems/lokator-yonalishi
Radar direction
Easy
1000 ms
64 MB
23%
A radar can face four directions: s — north, j — south, q — east, g — west. The starting direction $c$ and two commands $N_{1}$ and $N_{2}$, executed one after the other, are given. Commands: $0$ — no turn, $1$ — left by $90^{\circ}$, $2$ — right by $90^{\circ}$, $-1$ — a turn by $180^{\circ}$. Find the final direction of the radar.
Input
One line with a direction letter $c$ and two integers $N_{1}$ and $N_{2}$.
Output
One letter: the final direction (s, j, q or g).
Note
$c$ is s, j, q or g
$N_{1}, N_{2} \in \{-1, 0, 1, 2\}$
Examples
Input #1
s 1 1
Output #1
j
Input #2
q -1 2
Output #2
s