DCEPC12H - Height of Expectation

no tags 

Welcome To ICPC! ICPC is a programming competition in which N teams participate every year. Out of N teams, K number of teams has been selected from our college. You know what? K is always a prime number. Coincidence! Before going to ICPC, we want to calculate our expected overall score of our college.

Expected Overall score is defined as expected median value of our college team’s ranks.

All the ranks are distinct. Team’s rank value always lies between 1 to N.

Input

First line consists of T, the number of test cases.

Each of the next T lines contains 2 space separated integers N and K.

Output

Output T lines each line containing expected overall score of our college. You should output at least 6 digits after decimal.

Constraints

1<=T<=500

1<=N<=100

1<=K<=10

N>=K

Example

Input:
1
3 3

Output:
2.0000000

hide comments
Anand: 2014-12-28 16:26:26

easy one :) Pattern :D

Flago: 2014-05-07 14:21:27

I almost didn't submitted as my answer seemed too easy :D

SanchitK: 2014-04-01 20:43:15

please someone give a test case when n>10


Added by:dce coders
Date:2013-12-07
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CSHARP C++ 4.3.2 CPP C99 HASK JAVA PAS-GPC PAS-FPC PYTHON PYTHON3 PY_NBC