Solving equations with variables and constants