import sys import re m=list(input().split(';')) x,y=0,0 for step in m: if re.fullmatch(r'([ADWS]{1})(\d+)',step): d=step[0] s=int(step[1:]) if 0<s<100: if d == 'A': x=x-s elif d == 'D': x=x+s elif d == 'W': y=y+s elif d == 'S': y=y-s print('{},{}'.format(x,y))