infix notation to prefix notation conversion and reduce as much as possible