poj3299 solution