Solution to Problem A of the qualification round of Google Code Jam 2013. [http://code.google.com/codejam/contest/2270488/dashboard#s=p0]