final exam: problem 3