solving RPN