modify the solution to p16