A room on a flat plane is enclosed by a polygonal wall. Inside it a bar of length $L$ turns clockwise, like a twirling baton.
At the start one end of the bar (end A) sits at $(0, 0)$ and the other end (end B) sits at $(0, L)$. At that moment the bar touches the wall only at end A.
The bar turns around a single point where it touches the wall. As soon as another part of the bar reaches the wall, that new touching point becomes the center of rotation.
Find the coordinates of end A once the bar has turned $2\pi R$ radians clockwise in total.
The bar can also get stuck along the way. That is the state where no touching point lets it turn clockwise any further. The motion ends there, and the answer is the position of end A at that moment.
You may assume that when the length $L$ changes by $\varepsilon$ with $|\varepsilon| < 0.00001$, the final coordinates $(x, y)$ change by no more than $0.0005$.
The input holds several datasets. There are at most 100 of them. The end of the input is marked by 0 0 0.
Each dataset has the following format.
L R N
X1 Y1
X2 Y2
...
XN YN
$L$ is the length of the bar. The bar turns $2\pi R$ radians unless it gets stuck first. $N$ is the number of vertices of the polygonal wall.
The vertices of the polygon are given in counter-clockwise order. The polygon is simple, so its border never crosses or touches itself.
$N$, $X_i$ and $Y_i$ are integers, and $L$ and $R$ are decimal fractions. The ranges are as follows.
For each dataset, print the final position of end A on one line. The judge compares the output exactly, so write the coordinates as integers: multiply $x$ and $y$ by 1000, round each to the nearest integer, and print the two integers separated by one space.
In the test data, $1000x$ and $1000y$ stay at least $10^{-4}$ away from a rounding boundary, that is from any integer plus $0.5$, so the rounded value is uniquely determined.