#P989E. A Trance of Nightfall
A Trance of Nightfall
Description
"Flowing and passing like this, the water isn't gone ultimately; Waxing and waning like that, the moon doesn't shrink or grow eventually."
"Everything is transient in a way and perennial in another."
Kanno doesn't seem to make much sense out of Mino's isolated words, but maybe it's time that they enjoy the gentle breeze and the night sky — the inexhaustible gifts from nature.
Gazing into the sky of stars, Kanno indulges in a night's tranquil dreams.
There is a set of points on a coordinate plane.
Kanno starts from a point that can be chosen on the plane. is not added to if it doesn't belong to . Then the following sequence of operations (altogether called a move) is repeated several times, in the given order:
- Choose a line such that it passes through at least two elements in and passes through Kanno's current position. If there are multiple such lines, one is chosen equiprobably.
- Move to one of the points that belong to and lie on . The destination is chosen equiprobably among all possible ones, including Kanno's current position (if it does belong to ).
There are queries each consisting of two integers . For each query, you're to help Kanno maximize the probability of the stopping position being the -th element in after moves with a proper selection of , and output this maximum probability. Note that according to rule 1, should belong to at least one line that passes through at least two points from .
The first line contains a positive integer () — the number of points in .
The -th of the following lines contains two space-separated integers and () — the coordinates of the -th point in . The input guarantees that for all , holds.
The next line contains a positive integer () — the number of queries.
Each of the following lines contains two space-separated integers and (, ) — the index of the target point and the number of moves, respectively.
Output lines each containing a decimal number — the -th among them denotes the maximum probability of staying on the -th point after steps, with a proper choice of starting position .
Your answer will be considered correct if each number in your output differs from the corresponding one in jury's answer by at most .
Formally, let your answer be , and the jury's answer be . Your answer is considered correct if .
Input
The first line contains a positive integer () — the number of points in .
The -th of the following lines contains two space-separated integers and () — the coordinates of the -th point in . The input guarantees that for all , holds.
The next line contains a positive integer () — the number of queries.
Each of the following lines contains two space-separated integers and (, ) — the index of the target point and the number of moves, respectively.
Output
Output lines each containing a decimal number — the -th among them denotes the maximum probability of staying on the -th point after steps, with a proper choice of starting position .
Your answer will be considered correct if each number in your output differs from the corresponding one in jury's answer by at most .
Formally, let your answer be , and the jury's answer be . Your answer is considered correct if .
Note
The points in and possible candidates for line are depicted in the following figure.

For the first query, when , is uniquely determined to be , and thus Kanno will move to with a probability of .
For the third query, when , is chosen equiprobably between and . Kanno will then move to the other four points with a probability of each, or stay at with a probability of .