POJ 1742 solved