problem 1009 of pku online judge