#include <stdio.h>
#include <string.h>

int main(void)
{
	const char *commands[] = {"left", "right", "up", "down", NULL};
	char inp_command[6];
	int dir[] = {-1, 0, 1, 0, 0, -1, 0, 1};
	int x = 0, y = 0;
	
	while(scanf("%5s", inp_command) != EOF)
	{
		for (int i = 0; commands[i]; i++)
			if (!strcmp(inp_command, commands[i]))
			{
				x += dir[i * 2], y += dir[i * 2 + 1];
				break;
			}
	}
	printf("%d %d\n", x, y);
	return 0;
}