import sys
#import re
while True:
try:
text = sys.stdin.readline().split(';')
#sys.stdin.readline()可以实现标准输入,sys库,sys.stdin是一个标准化输入的方法,
# 其中默认输入的格式是字符串,如果是int,float类型则需要强制转换
initx = 0
inity = 0
l = []
# 小括号( ):代表tuple元组数据类型,元组是一种不可变序列
# 中括号[ ],代表list列表数据类型:
#{ }花括号:代表dict字典数据类型,字典是由键对值组组成。
# 冒号':'分开键和值,逗号','隔开组
# for i in text:
# if re.match(r'^[ASDW]\d+$',i): # 正则表达式匹配
# l.append(i)
for i in text:
if i[0] == 'A':
initx -= int(i[1:])
#赋值运算的一种,c -= a 等效于 c = c - a
if i[0] == 'D':
initx += int(i[1:])#这句话的意思是从1到后面的数
# d=a[:-1] #从位置0到位置-1之前的数
# e=a[:-2] #从位置0到位置-2之前的数
if i[0] == 'W':
inity += int(i[1:])
if i[0] == 'S':
inity -= int(i[1:])
else:
continue
print (str(initx) + ',' + str(inity))
except:
break