Created RPN algorithm