DP: min cost path