def is_good(asdw):
try:
if asdw[0] in ("A", "S", "D", "W") and 0 < int(asdw[1:]) < 100:
return True
except:
pass
return False
while True:
try:
ip = input()
zb_list = ip.split(";")
x, y = 0, 0
for i in zb_list:
if is_good(i):
if i[0] == "A":
x -= int(i[1:])
elif i[0] == "D":
x += int(i[1:])
elif i[0] == "S":
y -= int(i[1:])
elif i[0] == "W":
y += int(i[1:])
print("{},{}".format(int(x),int(y)))
except Exception as e:
break