Finish the second problem of hw2