solution for prob.45