solution for p1