Rayan and Sarah each have n magical stones. Rayan's stones have values a1,a2,…,an, and Sarah's stones have values b1,b2,…,bn.
They want to pair their stones: each of Rayan's stones must be paired with exactly one of Sarah's stones, and vice versa. The dissonance of a pairing is the sum of absolute differences between paired stones. Formally, if after reordering Sarah's stones become b1′,b2′,…,bn′, the dissonance is ∑i=1n∣ai−bi′∣.
Sarah can reorder her stones in any way before the pairing. Find the minimum possible dissonance.
Constraints
- 1≤t≤1000
- 1≤n≤1000
- 1≤ai≤1000
- 1≤bi≤1000
- The sum of n over all test cases does not exceed 104.