#2 Solver for problem 20