solving 4th problem
solving 5th problem