Solution for P04.
Includes solution to P05.