Finish the chapter 3 problem 4 in recursive way