Rewrite the "path_dp"
Main-Line AND Two-End