avid-cricketer-4

Statement :

Utkarsh and Debanjan are avid cricket and video game fans. They have recently purchased a new game , "Don Bradman Cricket 14". Debanjan challenges Utkarsh to play India vs Australia, and to defeat Australia in Legend Mode. Utkarsh has accepted the challenge and now faces a task to score "R" runs from "B" balls. Can you tell us the probability of Utkarsh winning the match if :

Every event is equiprobable.

The events are : {W,0,1,2,3,4,6}.

Note : Assume you have infinite wickets!

Input format:

First line contains T , the number of test cases. Each of the next T lines contains "R" , the number of runs required and "B" , the number of balls left.

Output format:

For every test case T , print the expected number of runs scored. Output should have exactly 6 decimal place precision.

Constraints:

1 ≤ T ≤ 10

1 ≤ R ≤ 1000

1 ≤ B ≤ 1000

SAMPLE INPUT
2
1 1
2 1

SAMPLE OUTPUT
0.714286
0.571429

Explanation

Case 1 : On the very first ball , he can score W , 0 , 1 , 2 , 3 , 4 , 6 with equal probability.

Case 2 : There are only 4 events that support a victory!

Source: hackerearth | Difficulty: EASY


Solutions: