from pickle import NONE
import re

a=input()
aa=a.split(';')
ff=[]
x=0
y=0
for t in aa:
   b=re.findall('(\d+)',str(t))
   #print(b)
   if len(b)==1 and int(b[0])<=99:
      c=re.findall('([ADWS])',str(t))
      if len(c)==1:
        z=int(b[0])
        if 'A' in str(c):
            x=x-z
            y=y
        elif 'S' in str(c):
            x=x
            y=y-z
        elif 'W' in str(c):
            x=x
            y=y+z
        elif 'D' in str(c):
            x=x+z
            y=y
        else:
            pass
print(str(x)+str(',')+str(y))