implement RPN