Solving equations with multiple operations