Sending Gift

Time Limit: 2 Seconds    Memory Limit: 32768 KB

Sending company has to send gift in the coming Christmas. One of the building of HangZhou which has 100 floors, there are many people working in the building will recieve gift in the coming Christmas. One of the staffer in the Sending company is dispatched to send gift to the tall building. It's so tired to send so many gift(but he has to do for money). Even worse there has no lift. Go up one floor cost 5 calories energy, Go down one floor cost 3 calories energy. The sending company aways use column to pack the gift, you can only fetch the gift at the two end of the column. Now the company pack these gift which sending to the tall building in two columns. Given the position(which floor) every gift has to send, now you are to find the min energy the staffer has to consume.

The staffer at the first floor at start.

Input

The first line if one integer P which is the test case.
Then P test follows,each test the first line if one integer N(N<=30) which is the number of gifts packed in the first column, the next line is N integers(between 1 and 100) which is the floor every gift (from one end to another) in the first column has to send.The next is one integer M(M<=30)which is the number of gifts packed in the second column, then next line is M integers (between 1 and 100) which is the floor every gift(from one end to another) in the second column has to send.

Output

Just one integer the min energy(calories) the staffer has to consume.

Sample Input

1 
2 
1 2 
3 
1 2 3 

Sample Output

10 
Submit

Source: ZOJ Monthly, October 2004