calculate mathematical expression using Reverse Polish notation