Solved problem 8, using bruteforce.