#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <complex>
#include <tuple>
#include <assert.h>
using namespace std;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define ALL(container) (container).begin(), (container).end()
#define mp(a,b) make_pair(a, b)

namespace geom{
#define X real()
#define Y imag()
#define at(i) ((*this)[i])
#define SELF (*this)
	enum {TRUE = 1, FALSE = 0, BORDER = -1};
	typedef int BOOL;
	typedef double R;
	const R INF = 1e8;
	R EPS = 1e-6;
	const R PI = 3.1415926535897932384626;
	inline int sig(const R &x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
	inline BOOL less(const R &x, const R &y) {return sig(x-y) ? x < y : BORDER;}
	typedef complex<R> P;
	inline R norm(const P &p){return p.X*p.X+p.Y*p.Y;}
	inline R inp(const P& a, const P& b){return (conj(a)*b).X;}
	inline R outp(const P& a, const P& b){return (conj(a)*b).Y;}
	inline P unit(const P& p){return p/abs(p);}
	inline P proj(const P &s, const P &t){return t*inp(s, t)/norm(t);}
	inline int ccw(const P &s, const P &t, const P &p, int adv=0){
		int res = sig(outp(t-s, p-s));
		if(res || !adv) return res;
		if(sig(inp(t-s, p-s)) < 0) return -2;	// p-s-t
		if(sig(inp(s-t, p-t)) < 0) return 2;	// s-t-p
		return 0;								// s-p-t
	}
	struct L : public vector<P>{	// line
		L(const P &p1, const P &p2){this->push_back(p1);this->push_back(p2);}
		L(){}
		P dir()const {return at(1) - at(0);}
	};
	struct S : public L{	// segment
		S(const P &p1, const P &p2):L(p1, p2){}
		S(){}
	};
	struct C : public P{
		C(){}
		C(const P& p, const R r):P(p), r(r){}
		R r;
		BOOL inside(const P& p)const { return less(norm(p-SELF), r*r);}
	};
	struct G : public vector<P>{
		G(size_type size=0):vector(size){}
		S edge(int i)const {return S(at(i), at(i+1 == size() ? 0 : i+1));}
	};

	inline P proj(const P &s, const L &t){return t[0] + proj(s-t[0], t[1]-t[0]);}
	inline P reflect(const P &s, const L &t){return 2.*proj(s, t) - s;}
	BOOL intersect(const S &s, const S &t){
		const int p = ccw(t[0], t[1], s[0], 1) * ccw(t[0], t[1], s[1], 1);
		const int q = ccw(s[0], s[1], t[0], 1) * ccw(s[0], s[1], t[1], 1);
		return (p>0||q>0) ? FALSE : (!p||!q) ? BORDER : TRUE;
	}
	R dist2(const L &l, const P &p){return norm(outp(l.dir(), p - l[0])) / norm(l.dir());}
	inline S crosspoint(const C &c, const L &l){
		R d2 = dist2(l, c);
		if(c.r*c.r+EPS < d2) return S();
		P m = proj(c, l);
		P u = unit(l[1]-l[0]);
		R d = sqrt(max(.0, c.r*c.r - d2));
		return S(m+u*d, m-u*d);
	}
	inline vector<P> crosspoint(const C &c, const S &s){
		vector<P> res = crosspoint(c, (const L&)s);
		RREP(i, res.size()){
			if(inp(res[i]-s[0], s.dir())*inp(res[i]-s[1], -s.dir())<EPS)
				res.erase(res.begin() + i);
		}
		return res;
	}
#undef SELF
#undef at
}

using namespace geom;

namespace std{
	bool operator<(const P &a, const P &b){return sig(a.X-b.X) ? a.X < b.X : a.Y+EPS < b.Y;}
	bool operator==(const P &a, const P &b){return abs(a-b) < EPS;}
	istream& operator>>(istream &is, P &p){R x,y;is>>x>>y;p=P(x, y);return is;}
	istream& operator>>(istream &is, L &l){l.resize(2);return is >> l[0] >> l[1];}
	istream& operator>>(istream &is, C &c){return is >> (P &)c >> c.r;}
}

R l, r;
int n;

S rot(S s, R ang){s[1] = s[0] + s.dir() * polar(1., ang); return s;}

pair<R, P> culc(const G& g, S s){
	if(abs(s.dir()) < EPS) return mp(INF, P(0., 0.));
	vector<tuple<R, R, P>> isc;
	REP(i, g.size()){
		if(abs(arg((g[i] - s[0]) / s.dir())) > EPS && norm(g[i] - s[0]) > EPS && norm(g[i] - s[0]) < norm(s.dir()) + EPS) 
			isc.emplace_back(arg((g[i] - s[0]) / s.dir()), -norm(g[i] - s[0]), g[i]);
		auto cp = crosspoint(C(s[0], abs(s.dir())), g.edge(i));
		FOR(p, cp){
			if(abs(arg((*p - s[0]) / s.dir())) > EPS)
				isc.emplace_back(arg((*p - s[0]) / s.dir()), -norm(*p - s[0]), *p);
		}
	}
	FOR(it, isc) if(get<0>(*it) < 0) get<0>(*it) += 2*PI;
	auto res = *min_element(ALL(isc));
	return mp(get<0>(res), get<2>(res));
}

int main(){
	ios::sync_with_stdio(false);
	while(cin >> l >> r >> n, n){
		r *= 2*PI;
		G g(n);
		REP(i, n){
			cin >> g[i];
			g[i] = reflect(g[i], L(P(0., 0.), P(0., 10.)));
		}
		vector<S> b(2);
		b[0] = S(P(0., 0.), P(0., 0.));
		b[1] = S(P(0., 0.), P(0., l));
		while(r > 0){
			pair<R, P> res[2];
			res[0] = culc(g, b[0]);
			res[1] = culc(g, b[1]);
			R rad = min(res[0], res[1]).first;
			if(rad > r) rad = r;
			if(rad < EPS) break;
			
			S check(rot(b[0], rad*.5)[1], rot(b[1], rad*.5)[1]);
			if([&](){
				REP(i, g.size()) if(intersect(check, g.edge(i)) == TRUE) return 1;
				return 0;
			}()) break;
			b[0] = rot(b[0], rad);
			b[1] = rot(b[1], rad);
			r -= rad;
			if(res[0] < res[1]) b[0][0] = b[1][0] = res[0].second;
			else  b[0][0] = b[1][0] = res[1].second;
		}
		P ans = reflect(b[0][1], L(P(0., 0.), P(0., 10.)));
		printf("%.10f %.10f\n", ans.X, ans.Y);
	}
	return 0;
}

Measured memory_bytes: 1380