p3 final code