you give rooted tree consist n vertex the vertex number 1 n root vertex 1 you give score array s_1 s_2 ldot s_nA multiset k simple path call valid follow condition true each path start 1 let c_i number path cover vertex for pair vertex uv 2le uvle n parent c_uc_vle 1 hold the value path multiset define sumlimits_i1n c_i s_iit show possible find valid multiset find maximum value valid multiset