GraphiCity developer competition

GraphiCity is organizing its annual developer competition!
Despite it being held every year, the organizers – for some reason – always push the start date of the competition back by several days. From what we know, the delaying of the event is actually part of a long-standing tradition, the details of which are as follows...

Each day, up until the very last day before the competition, the organizers look out the window, wait for the first person to pass by, and take a note of the color of their shoes.

The citizens of GraphiCity dress very randomly: every morning each person rolls N (1 <= N <= 100) regular dice. If the sum of the numbers is exactly 13, they put on red shoes; if less than 13, they put on white shoes; and if more than 13, they put on green shoes.

The organizers review the list the night before the competition. Considering that at least K examinations have already happened at this point, if the last K (1 <= K <= 1012) entries are red, they postpone the competition by one day, and do the process all over again the next day, until the competition can no longer be delayed.

As stated, this tradition has been around for a long time, so nobody wants it to change.

Task

Try to guess how many days of expected delay there is (with a 10-6 margin of error), using the input values of N and K!

Input

The first line of the input file contains a single integer T denoting the number of test cases.
Each of the next T line contains two integers: N and K.

Output

For each test case print single line with two number:
P - the probability that someone put red shoes, and E - expected delay of contest.

Sample input
1
3 1
Sample output
0.0972222222222 0.107692307692
algorithm

Criteria

  • Test cases
  • Probability calc method
  • Expected value calc method
  • Speed
  • Accuracy

Submission

To present your solution, find the mentors of Graphisoft.