def f(x):
if not (2 <= len(x) <= 3):
return False
if x[0] not in ('A', 'D', 'W', 'S'):
return False
for i in x[1:]:
if not ('0' <= i <= '9'):
return False
return True
li = filter(f, input().split(';'))
point = dict(x=0, y=0)
for opt in li:
if opt[0] == 'A':
x = -int(opt[1:])
y = 0
elif opt[0] == 'D':
x = int(opt[1:])
y = 0
elif opt[0] == 'W':
x = 0
y = int(opt[1:])
elif opt[0] == 'S':
x = 0
y = -int(opt[1:])
point['x'] += x
point['y'] += y
print(point['x'], end='')
print(',', end='')
print(point['y'])