infix to prefix conversion and reduce as much as possible