Antman is in the quantum realm. He has orbits which are concentric and circular. These are called Schrödinger's orbits because whenever Antman observes orbit , exactly two points at random on this orbit become photon sources and a light ray emerges connecting these two sources.
A ray of light is called -bright if it comes in contact with exactly orbits.
It is 9:40 in the morning at CS427, and being late in statistics class Mahadi challenges Shamik with the following—
If Antman is currently observing orbit , what is the probability that a -bright light will emerge?
Shamik, not being a Marvel fan, claims the problem is so trivial that it is left as an exercise for the contestants.
The first line of input contains a single integer — the number of orbits.
The second line contains integers — where is the radius of orbit .
The third line contains a single integer — the number of queries to to answer.
Following each of the next lines contain two integers and — the orbit in observation and the desired brightness of the light.
It is guaranteed that all are distinct.
For each query, print the desired probability in a single line.
Your answer is considered correct if its absolute or relative error doesn’t exceed .
Input | Output |
---|---|
3 239 77 169 2 2 3 1 1 | 1.000000000 0.499994427 |
There are infinitely many points in an orbit and there can be zero or infinitely many pairs of points that can produce a ray of light with our desired brightness.