#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(b > a) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(b < a) a = b; }

#define REP(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) REP(i, 0, n)

constexpr double EPS = 1e-7;

struct point {
	double x, y;
	point(double x_ = 0.0, double y_ = 0.0):x(x_), y(y_) {}
	point(const point &p):x(p.x), y(p.y) {}

	point operator+ (const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator- (const point &p) const {
		return point(x - p.x, y - p.y);
	}

	point operator* (double s) const {
		return point(x * s, y * s);
	}

	point operator* (const point &p) const {
		return point(x * p.x - y * p.y, x * p.y + y * p.x);
	}

	point operator/ (double s) const {
		return point(x / s, y / s);
	}

	bool operator< (const point &p) const {
		return x + EPS < p.x || (abs(x - p.x) < EPS && y + EPS < p.y);
	}

	bool operator== (const point &p) const {
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
};

point rotate90(const point &p) {
	return point(-p.y, p.x);
}

point rotate(const point &p, double theta) {
	const double s = sin(theta), c = cos(theta);
	return point(c * p.x - s * p.y, s * p.x + c * p.y);
}

double angle(const point &p) {
	return atan2(p.y, p.x);
}

double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

double abs(const point &p) {
	return sqrt(norm(p));
}

double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

double cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

struct line {
	point a, b;
	line(const point &a_, const point &b_):a(a_), b(b_){}
};

struct segment {
	point a, b;
	segment(const point &a_, const point &b_):a(a_), b(b_){}
};

struct circle {
	point c;
	double r;
	circle(const point &c_, const double &r_):c(c_), r(r_){}
};

typedef vector<point> polygon;

int ccw(const point &a, point b, point c) {
	b = b - a;
	c = c - a;
	const double tmp = cross(b, c);
	if(tmp > EPS) return 1; // ccw
	if(tmp < -EPS) return -1; // cw
	if(dot(b, c) < -EPS) return 2; // c, a, b 順に一直線上
	if(norm(b) + EPS < norm(c)) return -2; // a, b, c 順に一直線上
	return 0; //a, c, b 順で一直線上
}

point project(const line &l, const point &p) {
	const point dif = l.b - l.a;
	const double tmp = dot(p - l.a, dif) / norm(dif);
	return l.a + dif * tmp;
}

bool intersect(const segment &s, const segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0
		&& ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

bool intersect(const segment &s, const point &p) {
	return ccw(s.a, s.b, p) == 0;
}

double dist(const line &l, const point &p) {
	return abs(cross(l.b - l.a, p - l.a)) / abs(l.b - l.a);
}

double dist(const segment &s, const point &p) {
	if(dot((s.b - s.a), (p - s.a)) < 0) return abs(p - s.a);
	if(dot((s.a - s.b), (p - s.b)) < 0) return abs(p - s.b);
	return dist(line(s.a, s.b), p);
}

double dist(const point &a, const point &b) {
	return abs(a - b);
}

bool intersect(const circle &c, const segment &s) {
	return dist(s, c.c) < c.r + EPS;
}

point crosspoint(const segment &s, const segment &t) {
	if(!intersect(s, t)) return point(INT_MAX, INT_MAX);

	const double tmp = cross(s.b - s.a, t.b - t.a);
	if(abs(tmp) < EPS) return point(INT_MAX, INT_MAX);
	return t.a + (t.b - t.a) * cross(s.b - s.a, s.b - t.a) * (1.0 / tmp);
}

vector<point> crosspoint(const circle &c, const line &l) {
	vector<point> res;
	const point h = project(l, c.c);
	const double d = abs(h - c.c);
	if(d > c.r - EPS) {
		res.emplace_back(h);
	}
	else if(d <= c.r - EPS) {
		point v = l.b - l.a;
		v = v * sqrt(c.r * c.r - d * d) / abs(v);
		res.emplace_back(h + v);
		res.emplace_back(h - v);
	}

	return res;
}

vector<point> crosspoint(const circle &c, const segment &s) {
	vector<point> res;
	vector<point> tmp = crosspoint(c, line(s.a, s.b));
	for(const auto &p : tmp) {
		if(intersect(s, p)) res.emplace_back(p);
	}
	return res;
}

bool touch(const point &p, const vector<segment> &walls) {
	for(const auto &s : walls) {
		if(intersect(s, p)) return true;
	}
	return false;
}

point calculate_center(const point &A, const point &B, const polygon &P) {
	const segment bar(A, B);
	double max_dist = -1.0;
	point res;

	for(const auto &p : P) {
		if(intersect(bar, p)) {
			const double d = norm(p - A);
			if(max_dist + EPS < d) {
				max_dist = d;
				res = p;
			}
		}
	}

	return res;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(6);

	const double PI = acos(-1L);

	double L, R;
	int n;

	while(cin >> L >> R >> n && n) {
		R = R * (2 * PI);

		polygon P;
		P.reserve(n);

		rep(i, n) {
			int x, y;
			cin >> x >> y;
			P.emplace_back(-x, y);
		}

		vector<segment> walls;
		walls.reserve(n);

		rep(i, n) {
			walls.emplace_back(P[i], P[(i + 1) % n]);
		}

		point A(0, 0), B(0, L);
		bool A_is_center = true;

		while(R > EPS) { // くるくる
			point center = (A_is_center ? A : B);

			if(touch(center, walls)) {
				A_is_center = !A_is_center;
			}
			else {
				if(A_is_center) {
					center = calculate_center(B, A, P);
				}
				else {
					center = calculate_center(A, B, P);
				}
			}

			const point base_point = (A_is_center ? A : B);
			const double base_angle = angle(base_point - center);

			double min_angle = PI;

			for(const auto &p : P) {
				if(p == center) continue;
				if(norm(p - center) + EPS < L * L) {
					double theta = angle(p - center) - base_angle;
					if(theta < EPS) theta += 2 * PI;
					chmin(min_angle, theta);
				}
			}

			const circle C(center, dist(base_point, center));
			for(const auto &s : walls) {
				if(intersect(C, s)) {
					const auto cp = crosspoint(C, s);
					for(const auto &p : cp) {
						if(p == center) continue;
						double theta = angle(p - center) - base_angle;
						if(theta < EPS) theta += 2 * PI;
						chmin(min_angle, theta);
					}
				}
			}

			if(min_angle < PI) {
				const segment bar(A, B);
				for(const auto &s : walls) {
					if(!intersect(bar, s)) continue;

					const point p = project(line(s.a, s.b), center);
					const point q = crosspoint(s, bar);

					if(q.x >= INT_MAX) continue;
					if(q == s.a || q == s.b) {
						if(!(q == A || q == B)) {
							const point t = (q == s.a ? s.b : s.a);
							if(ccw(center, q, t) == 1) goto stop;
						}
						continue;
					}

					if(ccw(center, q, p) == 1) goto stop;
				}
			}

			chmin(min_angle, R);
			if(!(A == center)) A = rotate(A - center, min_angle) + center;
			if(!(B == center)) B = rotate(B - center, min_angle) + center;
			R -= min_angle;
		}
	stop:;

		cout << -A.x << " " << A.y << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1400