2nd day;recursive function by kataoka