Solves problem 30