added poj problem 1002