ICPC 2007 Asia Region, Problem A