calculate prefix expression