Mr. X has come up with a new string compression algorithm. Consider a string of length N which contains up to K distinct characters. The compression algorithm works as follows: Replace each maximal contiguous substring containing only one distinct character (repeated an arbitrary number of times) and replace it by 2 values: the character and the length of the substring.
For example, the string "aabbaaa" will be compressed to "a, 2, b, 2, a, 3". Thus the length of the compressed string is 6.

Since Mr. X is living in advanced times, the length of any integer is considered to be 1. For example, if a string is compressed to "a, 111, b, 13", then its length after compression is considered to be 4.

To test his algorithm, he needs to know the expected length of the compressed string for given N and K if the input string is randomly uniformly chosen from all possibilities. He wants to run this experiment multiple times for different N, K and needs your help.

-----Input-----
The first line of the input contains an integer T denoting the number of queries. The description of T test cases follows.
The first and only line of each test case contains two integers N and K denoting the number of letters in the input string and the maximum number of distinct characters that can be present in the string.

-----Output-----

For each test case, output a single line containing the expected length of the compressed string. 
Your answer will be considered correct if the absolute error is less than 10-2

-----Constraints-----
- 1 ≤ T ≤ 105
- 1 ≤ N, K ≤ 109

-----Example-----
Input:
2
3 1
3 2
Output:
2.0
4.0

-----Explanation-----Example case 1:

There is only one string: aaa with compressed string = a, 3. Therefore length = 2
Example case 2

Input strings:

"aaa": "a, 3". Length = 2

"aab": "a, 2, b, 1". Length = 4 

"aba": "a, 1, b, 1, a, 1". Length = 6

"abb": "a, 1, b, 2". Length = 4

"baa": "b, 1, a, 2". Length = 4

"bab": "b, 1, a, 1, b, 1". Length = 6

"bba": "b, 2, a, 1". Length = 4

"bbb": "b, 3". Length = 2

Expected value = (2+4+6+4+4+6+4+2)/8 = 32/8 = 4

Starter code:

Solutions:
for _ in range(int(input())):
	n,k=map(int,input().split())
	print(((2*n*(k-1))+2)/k)

for _ in range(int(input())):
	n,k=map(int,input().split())
	a=((2*n*(k-1))+2)/k
	print(a)

# cook your dish here
for _ in range(int(input())):
    n,k=map(int,input().split())
    print(2+(n-1)*((2)-(2/k)))

for t in range(int(input())):
    n,k=map(int,input().split())
    ans=(2*n)-(2*((n-1)/k))
    print(ans)

# cook your dish here
t=int(input())
for i in range(t):
	n,k=map(int,input().split())
	print(2*(n*k-n+1)/k)

test = int(input())
while(test):
    n,k = map(int,input().split())
    print(2*n-(2*(n-1)/k))
    test-=1

for _ in range(int(input())):
    n, k = map(int, input().split())
    print(2 * (((k - 1) * (n - 1) + k) / k))


for _ in range(int(input())):
    n,k=map(int,input().split())
    print(2+(n-1)*((2)-(2/k)))

t = int(input())
while(t>0):
	s = input()
	n,c = s.split(" ")
	n= int(n)
	c = int(c)
	output = 2 + (n-1)*(2-2/c)
	print(output,end="")
	if(t>1):
		print()
	t-=1

# cook your dish here
test = int(input())
while(test):
    n,k = map(int,input().split())
    print(2*n-(2*(n-1)/k))
    test-=1

# cook your dish here
for _ in range(int(input())):
    n,k=map(int, input().split())
    print(2*(n-1)*(k-1)/k + 2)

ans = ""
for t in range(int(input())):
	n, k = map(float, input().split())
	ans += str(2*(n - (n-1)/k)) + "\n"

print(ans)

# cook your dish here
T=int(input())
for i in range(T):
	N,K=input().split()
	N=int(N)
	K=int(K)
	a=2*(N-(N-1)/K)
	print(a)

T=int(eval(input()))
for i in range(T):
	n,k=list(map(int,input().split()))
	print(2.0*(n-1)*(1-1/k)+2.0)

T=int(input())
for i in range(T):
	N,K=input().split()
	N=int(N)
	K=int(K)
	a=2*(N-(N-1)/K)
	print(a)

def my(n,k):
    num = 2*(1+(k-1)*n)
    den = k
    return num/den

for _ in range(int(input())):
    n, k = map(int, input().split())
    print(my(n, k))

for _ in range(int(input())):
    n, k = map(int, input().split())
    print((2*(n*k-n+1))/k)

t=int(input())
while t:
  n,k=input().split(" ")
  n=int(n)
  k=int(k)
  ans=2*(n-((n-1)/k))
  print(ans)
  t-=1

for _ in range(int(input())):
    n,k = map(int,input().split())
    print(2*(n-1)*(k-1)/k + 2)

for _ in range(int(input())):
    n,k = map(int,input().split(" "))
    print(2 + (n - 1) * ((2 * (k - 1)) / k))

for _ in range(int(input())):
    n,k = map(int,input().split(" "))
    print((2*k + 2*(k-1)*(n-1))/k)

for _ in range(int(input())):
	n,k = [int(x) for x in input().split()]
	ans = (1 + n*(k-1))/k
	print(ans*2)

from sys import stdin
# t = int(input())
# nks = stdin.readlines()
# print(nks)
for _ in range(int(input())):
    n,k = [int(x) for x in input().split()]
    # n,k = [int(x) for x in line.split()]
    ans = (1 + n*(k-1))/k
    print(ans*2)