list1 = input().split(';') m = 0 n = 0 list2 = ['A','S','W','D'] for word in list1: try: word[0] in list2 and int(word[1:]) in range(0,100) x1 = word[0] x2 = word[1:] if x1 == 'A': m -= int(x2) elif x1 == 'D': m += int(x2) elif x1 == 'S': n -= int(x2) elif x1 == 'W': n += int(x2) except: continue print(str(m)+','+str(n))