Falling Diamonds (Large)

N diamonds drop onto x=0 and slide left or right at random, and each query asks the probability that a diamond rests exactly at (X, Y).

Hard8ProbabilitySimulationCombinatoricsNo attempts yetTime limit5sMemory limit512 MB

Problem

Diamonds are falling from the sky. People are buying up the spots where a diamond can land, because whoever owns the spot owns the diamond that lands on it. Someone has offered you one such spot, and you want to know whether the deal is worth taking.

Diamonds are shaped like diamonds: for integers XX and YY, a diamond is the square with vertices (X1,Y)(X-1, Y), (X,Y+1)(X, Y+1), (X+1,Y)(X+1, Y) and (X,Y1)(X, Y-1), and (X,Y)(X, Y) is called its center. Every diamond lies in the XYXY plane. XX is the horizontal direction and YY is the vertical direction. The ground is at Y=0Y = 0, and positive YY coordinates are above the ground.

The diamonds fall one at a time along the YY axis. Each one starts at (0,Y)(0, Y) with YY very large and falls straight down until it hits the ground or another diamond.

A diamond that hits the ground sinks until it is buried up to its center, then stops. So a diamond whose center reaches Y=0Y = 0 stops falling and stops sliding.

A diamond that hits another diamond vertex to vertex can start sliding down, without turning, in one of two directions: down and left, or down and right. If no diamond immediately blocks either side, it slides left or right with equal probability. If a diamond blocks one side, the falling diamond slides to the other side, and it keeps going that way until another diamond blocks it or it becomes buried in the ground. If diamonds block both sides, it stops where it is.

Consider the example in the picture. The first diamond hits the ground and stops half buried, with its center at (0,0)(0, 0). The second diamond slides left or right with equal probability. Here it went left, and it stopped buried in the ground next to the first diamond, at (2,0)(-2, 0). The third diamond also hits the first one. Sliding right, it stops buried in the ground; sliding left, it stops between and above the two diamonds already placed. It went left again, so it stopped at (1,1)(-1, 1). The fourth diamond has no choice. It slides right and stops buried in the ground at (2,0)(2, 0).

Given that NN diamonds fall one after another, compute the probability that one of them ends up with its center exactly at (X,Y)(X, Y).

Input

The first line contains the number of test cases, TT. Each of the next TT lines contains three integers: the number of falling diamonds NN, and the coordinates XX, YY of the spot you care about. The spot you are offered does not have to be at or near the ground.

Limits

  • 1T1001 \le T \le 100
  • 10000X10000-10000 \le X \le 10000
  • 0Y100000 \le Y \le 10000
  • X+YX + Y is even.
  • 1N1061 \le N \le 10^6

Output

For each test case, print one line in the form Case #x: p, where xx is the test case number starting from 1 and pp is the probability that one of the NN diamonds ends up with its center exactly at (X,Y)(X, Y).

Write pp with exactly six digits after the decimal point, rounded at the seventh digit. An empty spot prints as 0.000000 and a spot that is certainly filled prints as 1.000000. The answer is judged as an exact match against this format.