there n piece cake line the ith piece cake weight a_i 1 leq leq nThe tastiness cake maximum total weight adjacent piece cake ie maxa_1a_2 a_2a_3 ldot a_n1 a_nyou want maximize tastiness cake you allow follow operation operation ruin cake Choose contiguous subsegment al r piece cake 1 leq l leq r leq n reverse the subsegment al r array sequence a_l a_l1 dot a_rif reverse array a_1 a_2 dots a_l2 a_l1 underlinea_r underlinea_r1 underlinedot underlinea_l1 underlinea_l a_r1 a_r2 dot a_n1 a_nfor example weight initially 5 2 1 4 7 3 reverse subsegment a2 5 get 5 underline7 underline4 underline1 underline2 3 the tastiness cake 5 7 12 operation tastiness 4711find maximum tastiness cake operation