import sys
x, y = 0, 0
instruction = sys.stdin.readline().strip().split(';')
for ins in instruction:
# print(ins)
if len(ins) <= 1:
continue
if ins[0] not in ['A','S','W','D']:
continue
num = ins[1:]
for char in num:
if ord(char) < 48 or ord(char) > 57:
num = -1
break
if num == -1:
continue
zero_count = len(num) - len(str(int(num)))
if zero_count > 1:
continue
num = int(num)
if zero_count == 1 and num >= 10:
continue
# print(ins)
if ins[0] == 'A' and num > 0 and num < 100:
x -= num
if ins[0] == 'D' and num > 0 and num < 100:
x += num
if ins[0] == 'W' and num > 0 and num < 100:
y += num
if ins[0] == 'S' and num > 0 and num < 100:
y -= num
print(f'{x},{y}')