URI Online Judge | 2734

Trading Presents

By Leticia Maia, UFCG BR Brazil

Timelimit: 3

Hermione recently noticed that, even though her children always got the same N number of christmas presents, her daughter Rose always gets a lot dolls and make-up for while her son Hugo got all sorts of games. She thought that was unfair, so she did the following: she gave each present a “fun score”, and decided would switch some of Rose’s presents with Hugo’s presents in order to make the sum of fun scores for each child as similar as possible. Given the fun score for each present, calculate what is the smallest difference of total fun score that she can achieve, given that she can make any number of trades, but the number of presents for each child should remain the same.

Input

The first line of input is an integer T ( T < 100 ) that indicates the number of test cases. Each case starts with a line containing one integers N (0 ≤ N ≤ 100 ). The next line gives the fun score Ri(1 ≤ Ri≤ 100 ) of the Rose’s N presents. The next line gives the fun score Hi(1 ≤ Hi≤ 100 )  of the Hugo’s N presents.

\(\displaystyle\sum_{i=1}^{N}H_i + R_i <= 1000\)

Output

For each test case, print a line with a single integer representing the minimum possible difference between the total fun score for Hugo and Rose’s presents, after the trades were made.

Input Sample Output Sample

2

2

1 2

3 4

3

1 1 2

2 2 3

0

1