import sys

def zuobiao(input_str):
    input_str = input_str.split(";")
    x,y=0,0
    for i in input_str:
        if len(i) < 2 or len(i) > 3:
            continue
        dire = i[0]
        if not dire in "AWSD":
            continue
        num = i[1:]
        if not num.isdigit():
            continue

        des = int(num)
        if dire == "A":
            x -= des
        elif dire == "D":
            x += des
        elif dire =="W":
            y += des
        elif dire == "S":
            y -= des
    return f"{x},{y}"

input_data  = sys.stdin.read().strip()
print(zuobiao(input_data))