#include<bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl
#define dbg2(x,y) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<", "<<#y<<" = "<<(y)<<endl
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double EPS = 1e-8, INF = 1e12, PI = acos(-1.0);
typedef complex<long double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline long double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline long double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;
 
inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) > EPS)   return +1;	   // counter clockwise
	if(cross(b, c) < -EPS)   return -1;	  // clockwise
	if(dot(b, c) < -EPS)	 return +2;	  // c--a--b on line
	if(norm(b) + EPS < norm(c)) return -2;	   // a--b--c on line
	return 0;
}
inline G isCL(const P &c, long double r, const P &p1, const P &p2){
	long double x = dot(p1 - c, p2 - p1);
	long double y = norm(p2 - p1);
	long double d = x * x - y * (norm(p1 - c) - r * r);
	if(d < -EPS) return G(0);
	if(d < 0) d = 0;
	P q1 = p1 - (p2 - p1) * (x / y);
	P q2 = (p2 - p1) * (sqrt(d) / y);
	G res; res.pb(q1 - q2); res.pb(q1 + q2);
	return res;
}
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
enum { OUT, ON, IN };
int contains(const G& g, const P& p) {
  bool in = false;
  for (int i = 0; i < g.size(); ++i) {
	P a = curr(g,i) - p, b = next(g,i) - p;
	if (imag(a) > imag(b)) swap(a, b);
	if (imag(a) < EPS && EPS < imag(b))
	  if (cross(a, b) < -EPS) in = !in;
	if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) return ON;
  }
  return in ? IN : OUT;
}
#undef next
 
long double len, R;
int n;
 
inline double arg_(const P &p){
	double a = arg(conj(p));
	while(a < -EPS) a += 2 * PI;
	return a;
}
inline void rot(P &p, const P &c, double a){
	p = P(cos(a), sin(a)) * (p - c) + c;
}
 
int main(){
	while(cin >> len >> R >> n, n){
		R *= 2 * PI;
		 
		G g;
		rep(i, n){
			double x, y; cin >> x >> y;
			g.pb(P(x, y));
		}
		L bar(P(0, 0), P(0, len));
		P c(0, 0);
		 
		 
		int loop = 0;
		 
		while(R > EPS){
			//dbg2(bar[0], bar[1]);
			 
			long double r0 = abs(bar[0] - c);
			long double r1 = abs(bar[1] - c);
			 
			vector<pair<long double, P> > p0;
			vector<pair<long double, P> > p1;
			P next(c);
			long double nd = 0;
			 
			//頂点との交わり
			 
			rep(i, n){
				long double d = abs(g[i] - c);
				if(d < EPS) continue;
				if(d - EPS < r0){
					 
					long double a = arg_((g[i] - c) / (bar[0] - c));
					if(a > EPS) p0.pb(mp(a, g[i]));
					else if(ccw(c, g[i], g[(i + 1) % n]) == -1){
						R = -1; break;
					}
				}
				if(d - EPS < r1){
					 
					long double a = arg_((g[i] - c) / (bar[1] - c));
					if(a > EPS) p1.pb(mp(a, g[i]));
					else if(ccw(c, g[i], g[(i + 1) % n]) == -1){
						R = -1; break;
					}
				}
			}
			
			rep(i, n){
				const P &p = g[i];
				const P &q = g[(i + 1) % n];
				G g0 = isCL(c, r0, p, q);
				G g1 = isCL(c, r1, p, q);
				 
				if(r0 > EPS) rep(j, g0.size()){
					if(ccw(g0[j], p, q) != 2) continue;
					 
					long double a = arg_((g0[j] - c) / (bar[0] - c));
					if(a > EPS) p0.pb(mp(a, g0[j]));
					else{
						rot(g0[j], c, -.00005);
						if(contains(g, g0[j]) != IN){
							R = -1; break;
						}
					}
					 
				}
				if(r1 > EPS) rep(j, g1.size()){
					if(ccw(g1[j], p, q) != 2) continue;
					 
					long double a = arg_((g1[j] - c) / (bar[1] - c));
					if(a > EPS) p1.pb(mp(a, g1[j]));
					else{
						rot(g1[j], c, -.00005);
						if(contains(g, g1[j]) != IN){
							R = -1; break;
						}
					}
				}
			}
			if(R < EPS) break;
			if(!p0.size() && !p1.size()) break; //??????
			sort(all(p0)); sort(all(p1));
			 
			p0.insert(p0.end(), all(p1));
			sort(all(p0));
			 
			rep(i, p0.size()) if(abs(p0[i].first - p0[0].first) < EPS){
				long double d = abs(p0[i].second - c);
				if(d > nd + EPS){
					nd = d;
					next = p0[i].second;
				}
			}
			 
			long double ang = min(p0[0].first, R);
			R -= ang;
			rot(bar[0], c, -ang);
			rot(bar[1], c, -ang);
			c = next;
		}
		printf("%.9f %.9f\n", (double)bar[0].real(), (double)bar[0].imag());
	}
	 
	return 0;
}

Measured memory_bytes: 1312