Mushroom Monster (Small)

Given plate counts at 10-second intervals, compute the minimum eaten under free eating and under a constant eating rate.

Easy3SimulationGreedyInterviewNo attempts yetTime limit5sMemory limit512 MB

Problem

Kaylin loves mushrooms. Put them on her plate and she eats every one. In this problem she is working through a plate of mushrooms while Bartholomew keeps adding more pieces to it.

We look at the number of mushroom pieces on the plate at 10-second intervals. Bartholomew can put any non-negative integer number of pieces down at any moment, and the only way a piece leaves the plate is by being eaten.

Find the minimum number of pieces Kaylin could have eaten under each of two different methods of computation.

  1. Assume Kaylin can eat any number of pieces at any time.
  2. Assume that, starting with the first time we look at the plate, Kaylin eats at a constant rate whenever there are mushrooms on her plate.

Consider the observations 10, 5, 15, 5.

Under the first method Kaylin ate at least 15 pieces: she eats 5, then 10 more are put on her plate, then she eats another 10. There is no way she ate fewer.

Under the second method Kaylin ate at least 25 pieces. Her rate has to be at least 1 piece per second. She starts with 10 pieces on the plate. In the first 10 seconds she eats 10 pieces and 5 more are put down. Over the next 5 seconds she eats those 5, the plate stays empty for 5 seconds, and then Bartholomew puts 15 more pieces down. She eats 10 pieces in the last 10 seconds.

Input

The first line of the input gives the number of test cases, TT. TT test cases follow. Each test case takes two lines. The first line contains a single integer NN, and the second line contains NN space-separated integers mim_i, the number of mushroom pieces on Kaylin's plate at the start and at each following 10-second interval.

Limits

  • 1T1001 \le T \le 100
  • 2N102 \le N \le 10
  • 0mi1000 \le m_i \le 100

Output

For each test case, output one line in the format Case #x: y z, where xx is the test case number starting from 1, yy is the minimum under the first method of computation, and zz is the minimum under the second method of computation.