solves problem 20
solves problem 25