#Lutece0136. Pie
Pie
Migrated from Lutece 136 Pie
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
A lot of boys and girls come to our company to pie friends. After we get their information, we need give each of them an advice for help. We know everyone's height, and we believe that the less difference of a girl and a boy has, the better it is. We need to find as more matches as possible, but the total difference of the matches must be minimum.
Input
The input consists of multiple test cases. The first line of each test case contains two integers, , (), which are the number of boys and the number of girls. The next line contains float numbers, indicating the height of each boy. The last line of each test case contains m float numbers, indicating the height of each girl. You can assume that because we believe that there is no need to do with that if . All of the values of the height are between and .
The last case is followed by a single line containing two zeros, which means the end of the input.
Output
Output the minimum total difference of the height. Please take it with six fractional digits.
Samples
2 3
1.5 2.0
1.5 1.7 2.0
0 0
0.000000
Resources
The 5th Guangting Cup Central China Invitatio