The JAG Box is an ordinary rectangular box that is currently popular around the world. There are JAG Boxes. For each , the -th box has an integer weight .
You will build a vertical stack by repeatedly choosing one remaining box and inserting it at the very bottom of the current stack. When a box of weight is inserted at the bottom of the existing stack whose total weight is , that box receives load equal to .
Determine the minimum possible total load over all boxes.