#Lutece0576. Journey

Journey

Migrated from Lutece 576 Journey

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

In Tomb-sweeping Festival, Yangsir and her friends planned to have a journey in a park. The park has N attractions which form a circle and only between adjacent attractions there is a road, so there are NN roads in total. On the way to the park, Yangsir and her friends lost their way. After several twists and turns, they arrived at the park but they still didn't know which attraction they are on now.

title

Looking at the park's map, Yangsir wanted to know that: if they set attraction XX as starting point, what is the minimum time they needed to pass all N attractions at least once? They don't need to go back to the starting attraction and the time spend on attractions are ignored.

We number the NN attractions from 11 to NN clockwise, and the ithi_{th} road is the road between ithi_{th} and i+1thi+1_{th} attraction, except that the NthN_{th} road is the road between NN and 11. The NN roads are all undirected.

Input

There are multiple test cases. The first line of the input will be an integer TT (T10T \leq 10) indicating the number of test cases.

For each test case, the first line is only one integer NN (3N10003 \leq N \leq 1000), representing the number of attractions in the park. In the second line there are NN positive integers separated by one space representing the time needed to pass through the ithi_{th} road. All the integers above are within 1,000,0001,000,000.

Output

For each test case, print Case #t: first, in which tt is the number of the test case starting from 11. Then output NN integers separated by one space which are the minimum time needed if they start from 1st1_{st} attraction, 2nd2_{nd} attraction,..., NthN_{th} attraction.

Samples

输入数据 1

1
5
4 6 5 3 7

输出数据 1

Case #1: 18 19 19 20 18

Resources

10th UESTC Programming Contest Final