'''
解题思路:
定义一个将命令翻译成坐标移动的函数 x,y = fn(command),当command为空或不合法时,返回0,0
'''
def fn(s):
if s:
tmp = s[1:]
if s[0]=='A' and tmp.isdigit():
return -int(tmp),0
elif s[0]=='S' and tmp.isdigit():
return 0,-int(tmp)
elif s[0]=='W' and tmp.isdigit():
return 0,int(tmp)
elif s[0]=='D' and tmp.isdigit():
return int(tmp),0
else:
return 0,0
else:
return 0,0
while 1:
try:
pass
L = input().strip().split(';')
#print(L)
M = []
for s in L:
M.append(fn(s))
#print(M)
x=0
y=0
for s in M:
x += s[0]
y += s[1]
print(str(x)+','+str(y))
except:
break