while True: try: lst=input().split(';') # print(lst) csz=[0,0] for s in lst: if len(s) in (2,3) and s[0] in ('A','D','W','S') and s[1:].isdigit() : csz[0]+=s[0].count('A')*(-1)*int(s[1:])+s[0].count('D')*int(s[1:]) csz[1]+=s[0].count('S')*(-1)*int(s[1:])+s[0].count('W')*int(s[1:]) print(str(csz[0])+','+str(csz[1])) except: break