Google Code Jam - 2009 Round1A (A) Multi-base happiness