Being inspired by the ongoing popularity of animation films, the monkeys are trying to be smarter. They have realized that the only way to get smarter is to learn mathematics. Hence, they have started to do so. With the creative brains they have, they are applying math in all aspects of life.
One of these mathematician monkeys is standing in front of a multi-storied twin tower. The twin tower is a couple of tall buildings standing parallel to each other. Each of the buildings has n floors. The ground floor is floor 0, the next one is floor 1, and so on. So, there are 2n floors in total in the twin tower. Each of these floors has fruit inside it. The monkey knows in advance the amount of time required to eat the fruit on any floor.
The monkey starts from the ground floor, climbs up toward the top of the buildings, and has to eat exactly n fruits. From floor i, he has only two ways to go up to floor i + 1. He can either go to the floor - i + 1 of the same building that he is on, or to the floor i + 1 of the other building using a spiral stair connecting the two buildings. Needless to say that he can only climb to the next floor at each step.
As he is a good climber, climbing from one floor to the next one in the same building takes almost no time, but to the other building requires some specified amount of time.
Now, he wants to figure out the minimum time required to eat n fruits. Can you verify how good his math is?
Input
Input starts with an integer T (≤ 50), denoting the number of test cases.
Each test case consists of five lines.
The first line has a single integer n (1 ≤ n ≤ 1000), the number of floors in each building.
The 2nd line contains n integers separated by a single space. These integers denote the number of seconds required to eat the fruit on each floor for the first building. The time is given in ascending order of the floor i.e. the first integer is the number of seconds required to eat the fruit on the ground floor of the first building while the last integer is the time required for the fruit on the topmost floor.
The 3rd line, containing n integers, describes the same values for the right building. Each of the above 2n integers has a value between 1 and 100.
Line four has n - 1 space-separated integers. These values denote the time required to jump from the left building to the right one. So, the first integer is the number of seconds to jump from the ground floor of the left building to the 1st floor of the right building.
Finally, the fifth line contains n - 1 more integers giving the time required for jumping from the right building to the left one. The jumping times have values between 1 and 50.
Output
For each case, print the case number and the minimum number of seconds required to eat n fruits.
Sample
Sample Input | Sample Output |
---|---|
1 4 5 6 8 9 7 9 3 10 5 2 3 2 4 3 | Case 1: 26 |