Finished 2008 round 1C problem A