#加个函数判断合法操作 #再按照操作处理坐标 import sys def check_hefa(s): if len(s) > 3 or len(s) < 1: return False if s[0] in "ADWS": if s[1:].isdecimal(): return True while True: try: sl = input().strip().split(';') slc = [] for s in sl: if check_hefa(s): slc.append(s) zuobiao = [0,0] for s in slc: caozuo = s[0] step = int(s[1:]) if caozuo == 'A': zuobiao[0] -= step elif caozuo == 'D': zuobiao[0] += step elif caozuo == 'W': zuobiao[1] += step elif caozuo == 'S': zuobiao[1] -= step zuobiao = map(str, zuobiao) print(",".join(zuobiao)) except: # print(sys.exc_info()) break