#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define repn(i, m, n) for (int i = m; i < int(n); ++i)

#define X real()
#define Y imag()

typedef complex<double> P;
typedef pair<P, P> L;
typedef vector<P> Pol;

const double INF = 1e40;
const double EPS = 1e-8;
const double PI = acos(-1);

int sig(double r) {return (r < -EPS) ? -1 : (r > EPS) ? 1: 0;}
bool eq(double a, double b) {return abs(a - b) < EPS;}
bool near(P a, P b) {return abs(b - a) < EPS;}

ostream &operator<<(ostream &os, const L &a) {
  os << a.first << "-" << a.second;
  return os;
}

namespace std{
  /* ツ陛篠角ツづ?ソツーツト */
  bool operator<(P a, P b){
    double arg1 = arg(a), arg2 = arg(b);
    if (sig(arg1 - PI) >= 0) arg1 = -PI;
    if (sig(arg2 - PI) >= 0) arg2 = -PI;
    if (!eq(arg1, arg2)) return arg1 < arg2;
    return norm(a) > norm(b);
  }
}

// ツ禿?静?
double dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
// ツ外ツ静?
double cross(P a, P b) {return a.X * b.Y - a.Y * b.X;}

// ツ静シツ閉ェツづ個ベツクツトツδ?
P vec(L a) {return a.second - a.first;}

// ツ静シツ閉ェabツづ可妥篠つキツづゥツ点xツづ個暗環置
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(L s, P p) {
  P a = vec(s);
  p -= s.first;
  double cr = cross(a, p);
  if (eq(cr, 0)) {
    if (sig(dot(a, p)) < 0) return BACK;
    if (sig(norm(a) - norm(p)) < 0) return FRONT;
    return ON;
  }
  return (cr > 0) ? LEFT : RIGHT;
}

// ツ角ツ度
double arg(P a, P b) {return acos(dot(a, b) / (abs(a) * abs(b)));}
P plr(double theta) {return polar(1., theta);}
P rot(P p, double theta) { return p * plr(theta);}

// ツ偲仰影
P proj(P a, P b) {return a * dot(a, b) / norm(a);}
P perp(L l, P p) {return l.first + proj(vec(l), p - l.first);}
P refl(L l, P p) {return perp(l, p) * 2. - p;}
 
// ツ古ーツ債キツ板サツ津ィ ツ端ツ点ツづーツ甘慊づ?
bool iLL(L a, L b) {return !eq(cross(vec(a), vec(b)), 0);}
bool eqL(L a, L b) {return !iLL(a, b) && eq(cross(vec(a), b.first - a.first), 0);}
bool iLS(L a, L b) {return sig(cross(vec(a), b.first)) * sig(cross(vec(a), b.second)) <= 0;}
bool iSS(L a, L b) {
  int cwaf = ccw(a, b.first);
  int cwbf = ccw(b, a.first);
  int cwas = ccw(a, b.second);
  int cwbs = ccw(b, a.second);
  if ((cwaf | cwas | cwbf | cwbs) & ON) return true;
  return ((cwaf | cwas) & (cwbf | cwbs)) == (LEFT | RIGHT);
}

// ツ古ーツ点
P pLL(L a, L b) {return a.first + vec(a) * (cross(vec(b), b.first - a.first) / cross(vec(b), vec(a)));}

// ツ仰猟猟」
double dLP(L l, P x) {return abs(cross(vec(l), x - l.first)) / abs(vec(l));}
double dSP(L s, P x) {
  if (dot(vec(s), x - s.first) <= 0) return abs(x - s.first);
  if (dot(-vec(s), x - s.second) <= 0) return abs(x - s.second);
  return dLP(s, x);
}
double dLL(L a, L b) {return iLL(a, b) ? 0 : dLP(a, b.first);}
double dLS(L a, L b) {return iLS(a, b) ? 0 : min(dLP(a, b.first), dLP(a, b.second));}
double dSS(L a, L b) {return iSS(a, b) ? 0 : min(min(dSP(a, b.first), dSP(a, b.second)), min(dSP(b, a.first), dSP(b, a.second)));}

// ツ円
struct C{
  P c;
  double r;
  C() {}
  C(P c, double r) : c(c), r(r) {}
};

// 2ツ円ツづ個暗環置ツ甘鳴係
enum RELATION{SAME = 1, CONTAIN = 2, OVER = 4, NO_CROSS = 8, ONE_CROSS = 16, ONE_INSIDE_CROSS = 32, TWO_CROSS = 64};
int cRel(C c1, C c2) {
  double d = abs(c1.c - c2.c);
  if (near(c1.c, c2.c) && eq(d, 0)) return SAME;
  if (sig(d - (c1.r - c2.r)) < 0) return OVER;
  if (sig(d - (c2.r - c1.r)) < 0) return CONTAIN;
  if (eq(d, c1.r - c2.r)) return ONE_INSIDE_CROSS;
  if (eq(d, c1.r + c2.r)) return ONE_CROSS;
  if (sig(d - (c1.r + c2.r)) > 0) return NO_CROSS;
  return TWO_CROSS;
}

bool iCC(C a, C b) {return cRel(a, b) & (ONE_INSIDE_CROSS | ONE_CROSS | TWO_CROSS);}
// ツ点ツつェツ円ツづ可甘慊づ慊づェツづゥツつゥ
bool iCP(C c, P p) {return sig(abs(p - c.c) - c.r) <= 0;}
// ツ古ーツ債キツ板サツ津ィ
bool iCL(C c, L l) {return sig(c.r - dLP(l, c.c)) >= 0;}
// ツ円ツづ?古ーツ債キツつケツつクツ環ョツ全ツづ可甘慊づ慊づェツづ?づ?療?つ「ツ湘ェツ債?づ?&ツ暗按降ツづーツ催ュツ渉?
bool iCS(C c, L s) {return sig(c.r - dSP(s, c.c)) >= 0;}

// ツ古ーツ点
pair<P, P> pCC(C a, C b) {
  double d = abs(b.c - a.c);
  double x = (d * d + a.r * a.r - b.r * b.r) / (2 * d);
  P e = (b.c - a.c) / abs(b.c - a.c), w = e * P(0, 1) * sqrt(max(a.r * a.r - x * x, 0.));
  return make_pair(a.c + e * x - w, a.c + e * x + w);
}
pair<P, P> pCL(C c, L l) {
  P h = perp(l, c.c);
  P e = vec(l) / abs(vec(l)) * sqrt(max(c.r * c.r - norm(h - c.c), 0.0));
  return make_pair(h - e, h + e);
}

Pol pol;

int main() {
  double l, r;
  int n;
  for (;;) {
    cin >> l >> r >> n;
    if (eq(l, 0) && eq(r, 0) && n == 0) break;
    pol.clear();
    rep (i, n) {
      int x, y;
      cin >> x >> y;
      pol.push_back(P(x, y));
    }
    rep (i, n) {
      pol[i].Y *= -1;
      pol[i] *= plr(-PI / 2);
    }
    double ll = l;
    double rotate = 0;
    P res = 0, res0 = -l;
    for (;;) {
      /*
      cout << ll << endl;
      rep (i, n) cout << pol[i];
      cout << endl;
      //*/
      vector<P> v, vv;
      v.clear();
      vv.clear();
      rep (i, n) {
	if (sig(abs(pol[i]) - ll) <= 0) v.push_back(pol[i]);
	if (sig(abs(pol[i]) - (l - ll)) <= 0) vv.push_back(pol[i] * plr(PI));
	L line = L(pol[i], pol[(i + 1) % n]);
	if (iCS(C(0, ll), line)) {
	  pair<P, P> p = pCL(C(0, ll), line);
	  if (ccw(line, p.first) == ON) v.push_back(p.first);
	  if (ccw(line, p.second) == ON) v.push_back(p.second);
	}
	if (iCS(C(0, l - ll), line)) {
	  pair<P, P> p = pCL(C(0, l - ll), line);
	  if (ccw(line, p.first) == ON) vv.push_back(p.first * plr(PI));
	  if (ccw(line, p.second) == ON) vv.push_back(p.second * plr(PI));
	}
      }
      vector<P> tv, tvv;
      rep (i, v.size()) {
	if (eq(arg(v[i]), -PI) || eq(arg(v[i]), PI)) continue;
	if (near(v[i], 0)) continue;
	if (near(v[i], l - ll)) continue;
	if (near(v[i], -ll)) continue;
	tv.push_back(v[i]);
      }
      rep (i, vv.size()) {
	if (eq(arg(vv[i]), -PI) || eq(arg(vv[i]), PI)) continue;
	if (near(vv[i] * plr(PI), 0)) continue;
	if (near(vv[i] * plr(PI), l - ll)) continue;
	if (near(vv[i] * plr(PI), -ll)) continue;
	tvv.push_back(vv[i]);
      }
      v = tv;
      vv = tvv;
      sort(v.begin(), v.end());
      sort(vv.begin(), vv.end());
      /*
      cout << "v : ";
      rep (i, v.size()) cout << v[i];
      cout << endl;
      cout << "vv : ";
      rep (i, vv.size()) cout << vv[i];
      cout << endl;
      //*/
      double rr;
      if (!vv.empty() && (v.empty() || arg(vv[0]) < arg(v[0]))){
	rr = arg(vv[0]) + PI;
	//cout << vv[0] << " " << rr << endl;
	if (sig(rr + rotate - r * 2 * PI) >= 0) {
	  P vr = res - res0;
	  res += vr * (l - ll) / l * plr(r * 2 * PI - rotate) - vr * (l  - ll) / l;
	  break;
	}
	rotate += rr;
	rep (i, n) {
	  pol[i] *= plr(-rr);
	  pol[i] -= vv[0] * plr(-rr) * plr(PI);
	}
	P vr = res - res0;
	res += vr * (l - ll) / l * plr(rr) - vr * (l  - ll) / l;
	res0 += -vr * ll / l * plr(rr) + vr * ll / l;
	ll = abs(vv[0]) + ll;
      } else {
	rr = arg(v[0]) + PI;
	//cout << v[0] << " " << rr << endl;
	if (sig(rr + rotate - r * 2 * PI) >= 0) {
	  P vr = res - res0;
	  res += vr * (l - ll) / l * plr(r * 2 * PI - rotate) - vr * (l  - ll) / l;
	  break;
	}
	rotate += rr;
	rep (i, n) {
	  pol[i] *= plr(-rr);
	  pol[i] -= v[0] * plr(-rr);
	}
	P vr = res - res0;
	res += vr * (l - ll) / l * plr(rr) - vr * (l  - ll) / l;
	res0 += -vr * ll / l * plr(rr) + vr * ll / l;
	ll = ll - abs(v[0]);
      }
      //cout << "res : " << res << res0 << endl;
      //cout << rotate << endl;
      vector<pair<double, int> > op;
      rep (i, n) {
	if (ccw(L(pol[i], pol[(i + 1) % n]), -ll) == ON) {
	  if (pol[i].X > pol[(i + 1) % n].X) op.push_back(make_pair(-ll, 1));
	  else op.push_back(make_pair(-ll, -1));
	  break;
	}
      }
      rep (i, n) {
	if (ccw(L(pol[i], pol[(i + 1) % n]), l - ll) == ON) {
	  if (pol[i].X > pol[(i + 1) % n].X) op.push_back(make_pair(l - ll, 1));
	  else op.push_back(make_pair(l - ll, -1));
	  break;
	}
      }
      rep (i, n) {
	if (ccw(L(-ll, l - ll), pol[i]) == ON) {
	  if (sig(pol[(i + 1) % n].Y) > 0) {
	    op.push_back(make_pair(pol[i].X, -1));
	  } else if (sig(pol[(i + 1) % n].Y) < 0) {
	    op.push_back(make_pair(pol[i].X, 1));
	  } else if (pol[i].X < pol[(i + 1) % n].X) {
	    op.push_back(make_pair(pol[i].X, -1));
	  } else {
	    op.push_back(make_pair(pol[i].X, 1));
	  }
	}
      }
      sort(op.begin(), op.end());
      bool end = false;
      //rep (i, op.size()) cout << op[i].first << " " << op[i].second << endl;
      //cout << endl;
      rep (i, op.size() - 1) {
	if (op[i].second == 1 && op[i + 1].second == -1) end = true;
      }
      if (end) break;
    }
    res.Y *= -1;
    res *= plr(-PI / 2);
    printf("%.12lf %.12lf\n", res.X, res.Y);
  }
}

Measured memory_bytes: 0