# A: x-; D: x+; W: y+; S: y-
# 起点:(0,0)
while True:
    try:
        str1 = [i for i in input().split(';')]
        direction = {'A':1,'D':2,'W':3,'S':4}
        n = len(str1)
        x, y = 0, 0
        for i in range(n):
            tmp = str1[i]
            if not tmp:
                continue
            judge = direction.get(tmp[0],0)
            if judge and len(tmp)<=3:
                number = -1
                try:
                    number = int(tmp[1:])
                except:
                    pass
                if number >= 0:
                    if judge == 1:
                        x -= number
                    elif judge == 2:
                        x += number
                    elif judge == 3:
                        y += number
                    else:
                        y -= number
        print(x,end = ',')
        print(y)
    except:
        break