there n location snowy mountain range number 1 n connect n1 trail shape tree each trail length 1 some location base lodge the height h_i location equal distance near base lodge base lodge height 0there skier location skier initial kinetic energy 0 each skier want ski trail possible suppose skier skiing trail location j Skiers allow ski uphill ie h_i h_j it cost unit kinetic energy ski flat ground ie h_i h_j skier gain unit kinetic energy ski downhill ie h_i h_j for location compute length long sequence trail skier start location ski kinetic energy negative skier allow visit location trail multiple time