if __name__ == '__main__': steps = list(input().strip().split(';')) x, y = 0, 0 for step in steps: if len(step) < 1: continue direction = step[0] dist = step[1:] if not dist.isnumeric(): continue dist = int(dist) if direction == 'A': x = x - dist elif direction == 'D': x = x + dist elif direction == 'W': y = y + dist elif direction == 'S': y = y - dist print(','.join(map(str, [x, y])))