Solving equations with distribution