In the problem H of BCPC 2020 Final, Mocha had used most of her magic to protect Arad mainland. After that, Mocha tried to go back to her own world by travel magic. However, Mocha spent so much magic to protect Arad mainland that she can’t maintain mana stability during travel. As a result, Mocha found she woubld be transported into the Stillwater Prison!
The magic is forbidden in the Stillwater Prison, so Mocha wants to escape the Stillwater Prison as soon as possible. The Stillwater Prison can be regard as a convex polygon in an infinite two-dimensional plane. Mocha will be transported to some point which is strictly inside the polygon. Mocha will choose one point
which is on the edge of the polygon (
can also be some vertice of the polygon), then she will move from point
to point
along the segment
.
Mocha is too anxious to calm down and calculate. Please help her to calculate the minimum distance she needs to move to escape the Stillwater Prison. Since Mocha can’t confirm where she will be transported, you need to answer multiple queries.
The first line contains one integer
(
), indicating the number of vertices of the convex polygon.
In the next
lines, each line contains two integers
(
), indicating the coordinates of the vertices of the convex polygon. The coordinates of the vertices are given in counterclockwise order.
The next line contains one integer
(
), indicating the number of queries.
In the next
lines, each line contains two integers
(
), indicating the coordinate of the point
where Mocha will be transported to. It’s guaranteed that
is strictly inside the polygon.
For each query, print a real number in a single line, indicating the minimum distance she needs to move to escape the Stillwater Prison. Your answer will be considered correct if its relative or absolute error does not exceed
.