Problem 12 solved, but brute force is a nightmare - 1508180 ms time