RPN calculation