Jony lives in a "Bachelor's house" with some of his friends. You may assume it as a hostel but it doesn't operate as a hostel. To lead a life in a hostel is so much tough. They have to pay so many different bills in every month along with everyday marketing. There is a manager to whom everyone pays their bills in advance every month. There are six types of bills they have to pay, like House Rent, Meal, Internet Bill, Maid Bill, Electricity Bill, and Garbage Bill. As Jony has to pay all of his bills in advance so he has to fix a budget for him every month. He always gets confused to determine his budget as there are some issues. Help him out!

Note that, if current month's budget is less than current month's bill then he has to pay the remaining bills with next month's bill.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases. Each case contains six integers n1, n2..........n6 (1<=n<=2000) denoting House Rent, Meal, Internet Bill, Maid Bill, Electricity Bill, and Garbage Bill of current month. Next line contains one integer B (1<=B<=10000) denoting current month's budget. Again it will take six integers m1, m2 ....... m6 (1<=m<=2000), denoting next month's bills.

Output

For each case print case number in the first line. Then print next month's budget. Follow sample input output for better understanding.