Problem: Problem Statement
Little Chef doesn't love math anymore. He loves Aleksandra.


Sashen'ka is nice. They spend all the time together. Even their birthdays they are celebrating together, because they were born on the same day :)


And now, this day is coming...


Chef know that most of all Sasha loves numbers, that's why he bought N positive numbers to a girl.
From her side, Sasha as all girls, thought that if she likes something, then all people like that too. And bought to a boy N numbers too. xD
After all greeting young people decide to play a game with their gifts. The game will be continued for N turns, in each turn the following will be done:
Chef randomly choose some number x from his gift.
Sasha randomly choose some number y form her gift.
If x^y > y^x then girl will kiss fellow.
Numbers x,y will be discarded from gifts.
Now chef is wondering what is the expected number of times he will be kissed by Sasha ?

 

Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N denoting the number of numbers in each gift. The second line contains N space-separated integers A1, A2, ..., AN denoting the numbers Sasha gave to Chef. Next line describe B1, B2, ..., BN numbers boy gave to girl in the same way. 
 

Output
For each test case, output a single line containing answer for corresponding test. Your answer will be considered as correct if it will have absolute error not more then 10^-6.
 

Constraints
1 ≤ T ≤ 5
1 ≤ N ≤ 10^5
1 ≤ Ai ≤ 10^9
1 ≤ Bi ≤ 10^9
 

Example

Input
3
1
3
4
2
2 3
1 4
2
2 4
2 2

Output:
1.000000
1.500000
0.000000


 

Explanation
Example case 1. Game will have only 1 turn. Chef will choose 3, while Sasha will choose 4. Since 3^4>4^3 girl will kiss boy. Hence answer is 1.

Solution (in PYTHON):

Solution:
'''
Yet Another Nice Girl

Problem code: ARRGAME2

Problem Statement

Little Chef doesn't love math anymore. He loves Aleksandra.

Sashen'ka is nice. They spend all the time together. Even their
birthdays they are celebrating together, because they were born on the
same day :)

And now, this day is coming...

Chef know that most of all Sasha loves numbers, that's why he bought N
positive numbers to a girl.

From her side, Sasha as all girls, thought that if she likes
something, then all people like that too. And bought to a boy N
numbers too. xD

After all greeting young people decide to play a game with their gifts.
The game will be continued for N turns, in each turn the following will
 be done:

Chef randomly choose some number x from his gift.

Sasha randomly choose some number y form her gift.

If x^y > y^x then girl will kiss fellow.

Numbers x,y will be discarded from gifts.

Now chef is wondering what is the expected number of times he will be
kissed by Sasha ?

Input

The first line of the input contains an integer T denoting the number
of test cases. The description of T test cases follows.

The first line of each test case contains a single integer N denoting
the number of numbers in each gift. The second line contains N
space-separated integers A1, A2, ..., AN denoting the numbers Sasha
gave to Chef. Next line describe B1, B2, ..., BN numbers boy gave to
girl in the same way.

Output

For each test case, output a single line containing answer for
corresponding test. Your answer will be considered as correct if it
will have absolute error not more then 10^-6.

Constraints
1 <= T <= 5
1 <= N <= 10^5
1 <= Ai <= 10^9
1 <= Bi <= 10^9

Example

Input
3
1
3
4
2
2 3
1 4
2
2 4
2 2

Output:
1.000000
1.500000
0.000000

Explanation

Example case 1. Game will have only 1 turn. Chef will choose 3, while
Sasha will choose 4. Since 3^4>4^3 girl will kiss boy. Hence answer is
1.

Author:         ballon_ziq
Tester:         shangjingbo
Tags            ballon_ziq
Date Added:     2-08-2013
Time Limit:     2 sec
Source Limit:   50000 Bytes
'''

from math import log
from sys import stdin

#### codechef 2013-10 Yet Another Nice Girl

def search(x,B):
    def is_yes(mid):
        y = B[mid]
        # log(x^y) > log(y^x) whack a big number with log().
        # a = y * log(x); b = x * log(y)
        return x < y
    n = len(B); lo = 0; hi = n-1
    while lo < hi:
        mid = lo + (hi-lo)/2
        if is_yes(mid):
            hi = mid
        else:
            lo = mid + 1
    if is_yes(lo) is False:
        # Reach to the end but still cannot find 'Yes'.
        return 0
    return n-lo

def solve(A,B):
    B = sorted(B); ans = 0; n = len(A)
    ones = twos = 0
    for b in B:
        if b == 1:
            ones += 1
        if b == 2:
            twos += 1
    # This can be modeled as throwing balls A to bins B?
    for a in A:
        if a > 1:
            if a == 2:
                a = 4
            cnt = search(a,B)
            if a == 3:
                cnt += twos
            ans += cnt + ones            
    ans = ans * 1.0/n
    return ans

def check_test(A, B, data='', case=[0]):
    print
    print "test %d:" % case[0]
    print A
    if abs(A-B) > 1e-9:
        if data:
            print data
        print '>>>', A
        print '<<<', B
        print "!!!!!!!! FAIL !!!!!!!!"
    else:
        print ":::::::) OK"
    case[0] += 1

def unit_test():
    print
    A,B, ans = (3,),(4,), 1.0
    check_test(solve(A,B), ans, (A,B))

    A,B, ans = (2,3),(1,4), 1.5
    check_test(solve(A,B), ans, (A,B))

    A,B, ans = (2,4),(2,2), 0
    check_test(solve(A,B), ans, (A,B))

def output():
    for case in xrange(1, int(stdin.next()) + 1):
        N = int(stdin.next())
        A = [int(i) for i in stdin.next().split()]
        B = [int(i) for i in stdin.next().split()]
        ans = solve(A,B)
        print "%.6f" % ans

if __name__ == '__main__':
#    unit_test()
    output()