#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>
#include <utility>
using namespace std;

#define EPS 1e-7

typedef complex<double> P;
typedef const P &rP;
typedef pair<double,double> pdd;

double pi;


double dot(rP va, rP vb){
	return real(va) * real(vb) + imag(va) * imag(vb);
}

double cross(rP va, rP vb){
	return real(va) * imag(vb) - imag(va) * real(vb);
}

bool contains(const vector<P> &plg, rP pt){
	int cnt = 0;
	double y = imag(pt);

	for(int i = 1; i < plg.size(); ++i){
		int j = i - 1;

		double dyi = imag(plg[i]) - y;
		double dyj = y - imag(plg[j]);
		double tx = (dyi * real(plg[j]) + dyj * real(plg[i])) / (dyi + dyj);

		if(imag(plg[i]) >= y && imag(plg[j]) < y){
			if( tx < real(pt) ) ++cnt;
		}
		else if(imag(plg[i]) < y && imag(plg[j]) >= y){
			if( tx < real(pt) ) ++cnt;
		}
	}
	
	return (cnt % 2 != 0);
}

vector<P> intersectsc(rP p1, rP p2, rP pc, double r){
	P v12 = p2 - p1;
	P v1c = pc - p1;
	
	vector<P> ret;

	double a = norm(v12);
	double b = dot(v12, v1c);
	double c = norm(v1c) - r * r;

	double D = b * b - a * c;
	if( D <= EPS ){
		return ret;
	}

	double t1 = (b + sqrt(D)) / a;
	double t2 = (b - sqrt(D)) / a;
	
	if(-EPS < t1 && t1 < 1.0 + EPS){
		ret.push_back(p1 + v12 * t1);
	}
	
	if(t1 != t2){
		if(-EPS < t2 && t2 < 1.0 + EPS){
			ret.push_back(p1 + v12 * t2);
		}
	}

	return ret;
}

double difangle(double base, double angle){
	angle -= base;
	while(angle < EPS){ angle += 2.0 * pi; }
	return angle;
}

bool cmp(const pdd &p, const pdd &q){
	if(abs(p.first - q.first) > EPS){
		return p.first < q.first;
	}
	return p.second > q.second;
}

P solve(double L, double R, const vector<P> &plg){
	R *= 2.0 * pi;

	P ea, eb(0.0, L);
	double flc = 0.0;
	
	bool ans_ea = true;

	P chkrot = polar(1.0, -EPS);

	while(R > EPS){
		P center = ea + flc * (eb - ea);

		if(flc > EPS && !contains(plg, (ea - center) * chkrot + center)){
			break;
		}
		if(!contains(plg, (eb - center) * chkrot + center)){
			break;
		}

		vector<pdd> info;
		info.push_back(pdd(R, flc));
		vector<P> ret;
		for(int i = 1; i < plg.size(); ++i){
			ret = intersectsc(plg[i-1], plg[i], center, L * flc);
			for(int j = 0; j < ret.size(); ++j){
				double angle = arg(ret[j] - center);
				double base = arg(ea - eb);
				double dif = difangle(angle, base);
				info.push_back(pdd(dif, 0.0));
			}
			
			ret = intersectsc(plg[i-1], plg[i], center, L * (1.0 - flc));
			for(int j = 0; j < ret.size(); ++j){
				double angle = arg(ret[j] - center);
				double base = arg(eb - ea);
				double dif = difangle(angle, base);
				info.push_back(pdd(dif, 1.0));
			}

			ret = intersectsc(ea, eb, center, abs(center - plg[i]));
			for(int j = 0; j < ret.size(); ++j){
				double angle = arg(ret[j] - center);
				double base = arg(plg[i] - center);
				double dif = difangle(base, angle);
				
				double rt = abs(ea - ret[j]) / L;
				if(abs(rt - flc) > EPS){
					info.push_back(pdd(dif, rt));
				}
			}
		}
		
		sort(info.begin(), info.end(), cmp);
		
		P rot = polar(1.0, -info[0].first);
		ea = (ea - center) * rot + center;
		eb = (eb - center) * rot + center;

		for(int i = 0; i < info.size(); ++i){
			if(abs(info[i].first - info[0].first) > EPS){ break; }
			if(info[i].second < flc){
				R = -1e10;
				break;
			}
		}

		R -= info[0].first;
		flc = info[0].second;

		if(abs(flc - 1.0) < EPS){
			swap(ea, eb);
			flc = 0.0;
			ans_ea = !ans_ea;
		}
	}

	return ans_ea ? ea : eb;
}

int main(){
	pi = acos(-1.0);
	
	double L, R;
	int n, x, y;
	while(scanf("%lf%lf%d", &L, &R, &n), n){
		vector<P> plg(n + 1);
		for(int i = 0; i < n; ++i){
			scanf("%d%d", &x, &y);
			plg[i] = P(x, y);
		}
		plg[n] = plg[0];
		
		P ans = solve(L, R, plg);
		printf("%f %f\n", real(ans), imag(ans));
	}
}

Measured memory_bytes: 1340