you give array contain n integer you choose proper subsegment a_l a_l 1 ldot a_r array mean choose integer 1 le l le r le n r l 1 n we define beauty give subsegment value follow expressionmaxa_1 a_2 ldot a_l1 a_r1 a_r2 ldot a_n mina_1 a_2 ldot a_l1 a_r1 a_r2 ldot a_n maxa_l ldot a_r mina_l ldot a_rplease find maximum beauty proper subsegment