felicity-binds
Source: hackerearth
Difficulty: EASY

A model show rates partakers according to their degree of fieriness. Two different model shows were organized, one for men and the other for women.

Now the repercussion of both model shows are out. The partakers of both the model shows have decided to date each other, but as usual they have difficuly in choosing their partners. The Dil Mil Gaye Serive (DMGS) comes to their rescue and matches them in such a way that that maximizes the fieriness bonds for all couples.

If a man has been rated at fieriness level x and a women at fieriness level y, the value of their fieriness bond is x*y.

Both model shows contain N partakers each. DMGS has done its job and your job is to find the sum of fieriness bonds for all the couples that DMGS has proposed.

Input

The first line of the input contains an integer t, the number of test cases. t (1 ≤ t ≤ 1500) test cases follow.

Each test case consists of 3 lines:

The first line contains a single integer N (1 ≤ N ≤ 1000). 
The second line contains N integers separated by single spaces denoting the fieriness levels of the men. 
The third line contains N integers separated by single spaces denoting the fieriness levels of the women. 
note: All fieriness ratings are on a scale of 0 to 10.

Output

For each test case output a single line containing a single integer denoting the sum of the fieriness bonds for all pairs that DMGS has proposed.

SAMPLE INPUT
2
2
1 1
3 2
3
2 3 2
1 3 2

SAMPLE OUTPUT
5
15


for _ in range(eval(input())):
	noe = eval(input())
	males = list(map(int, input().split()))
	fmale = list(map(int, input().split()))
	
	males.sort()
	fmale.sort()
	hot = 0
	for i in range(noe):
		hot += males[i] * fmale[i]
	print(hot)    


t=int(eval(input()))
while(t):
	s=0
	n=int(eval(input()))
	a=list(map(int,input().split()))
	b=list(map(int,input().split()))
	a.sort();
	b.sort();
	for i in range(n):
		s+=a[i]*b[i]
	print(s)
	t=t-1



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t=int(input())
for u in range(t):
	n=int(input())
	a=list(map(int,input().split()))
	b=list(map(int,input().split()))
	a.sort()
	b.sort()
	s=0
	for i,j in zip(a,b):
		s+=(i*j)
	print(s)	


for i in range(int(input())):
	N=int(input())
	men=list(map(int, input().split()))
	women=list(map(int, input().split()))
	men.sort()
	women.sort()
	sum_=0
	for i in range(N):
		sum_+=(men[i]*women[i])
	print(sum_)


n=int(eval(input()))
while(n):
	s=0
	m=int(eval(input()))
	a=list(map(int,input().split()))
	b=list(map(int,input().split()))
	a.sort()
	b.sort()
	for i in range(m):
		s=s+(a[i]*b[i])
	print(s)
	n=n-1


t=int(input())
while t:
	t-=1
	n=int(input())
	m=list(map(int,input().split()))
	f=list(map(int,input().split()))
	m=sorted(m)
	f=sorted(f)
	sum1=0
	for i in range(len(m)):
		sum1=sum1+(int(m[i])*int(f[i]))
	print(sum1)