change target function to get min sum as unique path problem