Added Problem 3 solving