import sys
while True:
try:
instr = input().split(';')
x, y = 0, 0
for i in instr:
i = i.strip()
if i[:1] == 'A' and not any(char.isalpha() for char in i[1:]):
tnum = int(i[1:])
if tnum >=1 and tnum <=99:
x = x - tnum
if i[:1] == 'D' and not any(char.isalpha() for char in i[1:]):
tnum = int(i[1:])
if tnum >=1 and tnum <=99:
x = x + tnum
if i[:1] == 'W' and not any(char.isalpha() for char in i[1:]):
tnum = int(i[1:])
if tnum >=1 and tnum <=99:
y = y + tnum
if i[:1] == 'S' and not any(char.isalpha() for char in i[1:]):
tnum = int(i[1:])
if tnum >=1 and tnum <=99:
y = y - tnum
print("{},{}".format(x, y))
except:
break