consider infinite triangle layer Lets number layer start triangle the kth layer triangle contain k point number leave right each point infinite triangle describe pair number r c 1 le c le r r number layer c number point layer from point r c direct edge point r1 c r1 c1 edge activate if r c edge point r1 c activate edge point r1 c1 activate Look picture well understand activate edge color black nonactivated edge color gray from point r_1 c_1 possible reach point r_2 c_2 path activate edge for example picture path 1 1 3 2 path 2 1 1 1initially point 1 1 for turn replace activate edge point r c that edge point r1 c activate instead edge point r1 c1 activate edge point r1 c1 instead edge point r1 c activate this action increase cost path 1 move current point follow activate edge this action increase cost path you give sequence n point infinite triangle r_1 c_1 r_2 c_2 ldot r_n c_n find minimum cost path 1 1 pass n point arbitrary order