Compass Conundrum


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 Ais 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 0≤c≤3590 \le c \le 359, meaning that the direction is c degrees from North in a clockwise direction.

Input

The input will be a line containing an integer nn. The following nn lines will each have a compass bearing for you to convert to true bearing.

Output

nn lines, listing out the directions in true bearings.

Constraints

  • 1≤n≤10001 \le n \le 1000
  • 0≤d≤450 \le d \le 45

Example 1

Input
Input 1
5
N45E
S42W
N5W
S38E
N29W
Input 2
45T
222T
355T
142T
331T

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.