
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 x=−1, and the right river is exactly the vertical line x=1. A bridge is drawn as a segment parallel to the x-axis that connects one point on each river. Each house is a point on one of the vertical lines.
The left houses are at (−1,ai) (i=1,…,n) and the right houses are at (1,bj) (j=1,…,m). If the bridge is placed at height h (that is, it connects the points (−1,h) and (1,h)), the distance from a left house ai across the bridge to a right house bj is ∣ai−h∣+2+∣h−bj∣.
Write a program that finds the bridge height h minimizing the sum of these distances over all (left house, right house) pairs:
∑i,jd(ai,bj)=∑i,j(∣ai−h∣+2+∣h−bj∣)
The first line contains the number of test cases T.
The first line of each test case contains two integers n and m (1≤n,m≤106), where n is the number of houses on the left river and m is the number of houses on the right river. The next n lines each contain a left house position ai, and the following m lines each contain a right house position bj (∣ai∣,∣bj∣≤107). All positions are integers.
For each test case, print on its own line the height h that minimizes the sum of distances, rounded to one decimal place. If several such h exist, print the smallest one.