Working with stacks and RPN