# 2024年10月29日   周二   下午16:54

s = input().split(";")  # A10;S20;W10;D30;X;A1A;B10A11;;A10;
start = [0, 0]
for i in s:
    if not 2 <= len(i) <= 3:
        continue
    else:
        try:
            d = i[0]
            step = int(i[1:])
            if d in ["A", "D", "W", "S"]:
                if 0 <= step <= 99:
                    if d == "A":
                        start[0] -= step
                    elif d == "D":
                        start[0] += step
                    elif d == "W":
                        start[1] += step
                    elif d == "S":
                        start[1] -= step

        except:
            continue
print(str(start[0]) + "," + str(start[1]))