problem 1006 of pku online judge