There are fish in a line, with weights from left to right.
You choose one fish and give it a non-negative integer amount of food, increasing its weight by . After that, only the chosen fish can eat other fish.
In one step, the chosen fish may eat either of its current immediate neighbors, provided that its own weight is at least the weight of that neighbor. The eaten fish is removed from the line, and its weight is added to the chosen fish's weight. The relative order of the remaining fish does not change.
For every from to , find the minimum value of that allows fish to eat all the other fish.
The answers are independent: each time, you start with the original line and original weights.
The first line contains the number of test cases .
For each test case, the first line contains . The second line contains , the initial weights of the fish from left to right.
For each test case, print one line containing integers. The value must be the minimum amount of food needed when fish is chosen.
If fish receives units of food, its weight becomes . It can eat the fish with initial weights , , , and , in that order. With less food, its weight after eating the fish of weight would be less than , so it would be stuck.
Fish needs no food. Fish can receive units, eat fish to reach weight , and then eat all fish to its left.
Either fish of weight can eat all the others without extra food. A fish of weight can receive units of food and eat the other two fish of weight , reaching weight . It can then eat both remaining fish. With less than units, even after eating both other small fish, it is too light to eat either fish of weight .
Fish can receive unit of food and eat fish , reaching weight , before eating fish . Without food, it cannot make its first move.
Fish can receive unit and eat fish , reaching weight . Without food, it can only eat fish and then gets stuck at weight .
Fish can eat both other fish without extra food.