my_str = input().split(';')
start =[0,0]

for item in my_str:
    if not 2 <= len(item) <= 3:
        continue		#

    try:
        direction = item[0]
        step = int(item[1:])
        if direction in ['A','D','W','S']:
            if 0 <= step <= 99:
                if direction == 'A':
                    start[0] -= step
                elif direction == 'D':
                    start[0] += step
                elif direction == 'W':
                    start[1] += step
                elif direction == 'S':
                    start[1] -= step

    except:
        continue		#

print(str(start[0]) + ',' + str(start[1]))