You own a factory with two assembly lines. The first assembly line makes boxes, and the second assembly line makes toys to put in those boxes. Each type of box goes with one type of toy and viceversa.
At the beginning, you pick up a box from the first assembly line and a toy from the second assembly line. You then have a few options.
Warning: The two assembly lines make a lot of boxes and toys. However, they tend to make one kind of thing for a long period of time before switching.
The first line of the input gives the number of test cases, T. T test cases follow.
Each test case begins with a line contains two integers N and M. It is followed by a line containing 2 * N integers a_{1}, A_{1}, a_{2}, A_{2}, ..., a_{N}, A_{N}, and another line containing 2 * M integers b_{1}, B_{1}, b_{2}, B_{2}, ..., b_{M}, B_{M}.
This means that the first assembly line will make a_{1} boxes of type A_{1}, then a_{2} boxes of type A_{2}, etc., until it finishes with a_{N} boxes of type A_{N}. Similarly, the second assembly will make b_{1} toys of type B_{1}, followed by b_{2} toys of type B_{2}, etc., until it finishes with b_{M} toys of type B_{M}.
A toy can be matched with a box if and only if they have the same type number.
For each test case, output one line containing "Case #x: y", where x is the case number (starting from 1), and y is the largest number of boxed toys that you can send out to customers.
1 ≤ T ≤ 100.
1 ≤ a_{i}, b_{i} ≤ 10^{16}.
1 ≤ A_{i}, B_{i} ≤ 100.
1 ≤ N ≤ 3.
1 ≤ M ≤ 100.
1 ≤ N, M ≤ 100.
Input 
Output 
4

Case #1: 35

Points  Correct  Attempted 

12pt  1064  1800 
23pt  308  786 