Solution to problem 017