Bruteforce solution for problem 009.