task 6, parse polynomial