Solves problem 27