problem 1008 of pku online judge