Performs middle-school algebraic manipulations