how to solve a substitution in math