solve p1