Solved problem 14 (naive)