Solved problem 7 (slowly).