public class Main {
	public static void main(String[] args) {
		System.out.println(java.text.MessageFormat.format(
		    "x = {1}, y = {0}, direction = {2, choice, 0#north|1#east|2#south|3#west}", 
		    new java.util.Scanner(System.in)
		        .useDelimiter("\\R")
		        .tokens()
		        .mapToInt(s -> Integer.parseInt(s.substring(7).trim()) << s.charAt(0) / 'r' * ' ' / 2)
		        .mapToObj(data -> new Integer[] {(int)(short) data, (data >> 16) / 90})
		        .reduce(
		            new Integer[]{0,0,0},
		            (turtle, action) -> {
		                turtle[2] += action[1];
		                turtle[2] %= 4;
		                turtle[turtle[2] % 2] += turtle[2] < 2 ? action[0] : -action[0];
		                return turtle;
		            })));
	}
}