s=input() l=s.split(';') x,y=0,0 #初始化x,y for i in l: flag=0# 用来判断数字是否合规 if len(i) not in [2,3]: continue direction=i[0] dis=i[1:] try: dis=int(dis) flag=1#数字合规 except: flag=0#数字不合规 if flag==1: if direction=='A': x-=dis elif direction=='S': y-=dis elif direction=='W': y+=dis elif direction=='D': x+=dis ans=''+str(x)+','+str(y) print(ans)