How to do algebraic long division