Your child is going off onto a hike, but you are worried that they are going to get lost, starve, and die. Even worse is that they do not understand how compass bearings work. You decide to create a program to convert from compass bearings to true bearings in order to help.
A compass bearing takes the form AdB
, where A
is one of N
, S
, and B
is one of E
and W
, representing one of the four cardinal directions.
d
is an integer which states that the direction points d
degrees away from A
and towards B
.
A true bearing takes the form cT
, where , meaning that the direction is c
degrees from North in a clockwise direction.
Input
The input will be a line containing an integer . The following lines will each have a compass bearing for you to convert to true bearing.
Output
lines, listing out the directions in true bearings.
Constraints
Example 1
Input
5
N45E
S42W
N5W
S38E
N29W
45T
222T
355T
142T
331T
Comments