Combining like terms with rational coefficients