poj2593. dynamic programming