words = input().strip().split(';') xy = [0,0]#初始坐标 def getCoordinate(word):#分析坐标是否合法 if len(word)>=2: direction = word[0] if direction not in {'A','D','W','S'}: return 0,0 # 方向不合法 num = word[1:] try: num = int(num) except ValueError: return 0,0 #数字不合法 return direction,num return 0,0 #长度不合法 for word in words: #判断坐标是否合法 direction,num = getCoordinate(word) #获取坐标及方向 if direction:# if direction == 'A': xy[0]-=num elif direction == 'D': xy[0]+=num elif direction == 'W': xy[1]+=num elif direction == 'S': xy[1]-=num print(str(xy[0])+','+str(xy[1]))