def get_ans(s):
if not s: return
x,y,li=0,0,s.split(';')
for item in li:
try:
direction,step=item[0],item[1:]
if direction=='A': x-=int(step)
if direction=='D': x+=int(step)
if direction=='W': y+=int(step)
if direction=='S': y-=int(step)
except:
continue
return x,y
if __name__=='__main__':
import sys
lines = []
while True:
line = sys.stdin.readline().strip()
if line == "":
break
lines.append(line)
for item in lines:
print('{},{}'.format(get_ans(item)[0],get_ans(item)[1]))