actions = input().split(";")
x, y = 0, 0
for action in actions:
    if len(action) < 2 or len(action) > 3:
        continue
    try:
        num = int(action[1:])
    except Exception:
        continue
    if action[0] == 'A':
        x -= num
    elif action[0] == 'D':
        x += num
    elif action[0] == 'S':
        y -= num
    elif action[0] == 'W':
        y += num       
print("{},{}".format(x, y))