Bridge
InterviewTime limit3sMemory limit128 MB
Find the bridge height that minimizes the total crossing distance over every pair of left and right houses.
Problem

Two rivers flow through a city from north to south, and houses stand in a row along each river, as in the picture. To let the people living on both banks reach the other side faster, we want to build a single bridge connecting the two rivers.
The left river is exactly the vertical line , and the right river is exactly the vertical line . A bridge is drawn as a segment parallel to the -axis that connects one point on each river. Each house is a point on one of the vertical lines.
The left houses are at () and the right houses are at (). If the bridge is placed at height (that is, it connects the points and ), the distance from a left house across the bridge to a right house is .
Write a program that finds the bridge height minimizing the sum of these distances over all (left house, right house) pairs:
Input
The first line contains the number of test cases .
The first line of each test case contains two integers and (), where is the number of houses on the left river and is the number of houses on the right river. The next lines each contain a left house position , and the following lines each contain a right house position (). All positions are integers.
Output
For each test case, print on its own line the height that minimizes the sum of distances, rounded to one decimal place. If several such exist, print the smallest one.