Problem1009 solved with bruteforce