#比动态规划简单多了,我恨动态规划

#输入
s=input().split(';')

#去除失效命令:
s=[x for x in s if len(x)>1 and x[0] in ('A','S','W','D') and x[1:].isdigit() ] 
#注意表达式中for语句在前,if语句在后

start=[0,0]
for x in s:
    if x[0]=='A':
        start[0]-=int(x[1:])
    elif x[0]=='D':
        start[0]+=int(x[1:])
    elif x[0]=='W':
        start[1]+=int(x[1:])
    elif x[0]=='S':
        start[1]-=int(x[1:])
#输出
print(','.join(map(str,start)))