solved p3 and p4