This is the job the bear finds
This is the job the bear finds
This is the job the bear finds
Not with a code but a brick. - Kenneth Snow, The Hollow Bear
Bearchild is working in a construction team. Life is hard, and his job is just carrying bricks from here to there, what a waste of time! So, our lovely Bearchild has invented a strange machine to help him.
The machine consists three parts: A rope, a little, round pulley (regarded as points) and a big pulley which is a convex hull (Bearchild is short of money and can't make his big pulley round!).
One end of the rope is fixed with bricks, the rope goes around the small pulley, and finally connects the big pulley on its contour. It's guaranteed that the small pulley is located to the left of the big one.
You can see that when the big pulley spins clockwise around its center of gravity, the bricks will be pulled up, and finally reach the small pulley as the destination. Note that the rope will circle around the contour of the big pulley as it spins.
See the picture for more information, there will be no collision when spinning.
In this problem, first of all we let the pulley spin for one or more circles so the rope becomes tight.
After that, the positions of the two pulleys are given. Then you have to deal a lot of queries, for each query, the distance from the bricks and the small pulley (also as the destination) is given.
Your task is to calculate the degree the pulley has yet to spin to pull the bricks to the destination.