A solution to the poj 1556