#include<bits/stdc++.h>

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef long double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Poly;
typedef pair<P,D> C;

const D EPS = 1e-9;
const D PI = acos(-1);

namespace std{
  bool operator<(const P &a,const P &b){
    return EQ(real(a),real(b))?imag(a)<imag(b):real(a)<real(b);
  }
  bool operator==(const P &a, const P &b){return EQ(a,b);}
}

//for vector
inline P unit(P p){return p/abs(p);}
inline pair<P,P> norm(P p){return make_pair(p*P(0,1),p*P(0,-1));}
inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}

//rotate a point counter-clockwise on the origin
inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

//return seta A
inline D arg(P a,P b,P c){
  D val = dot(b-a,c-a)/(abs(b-a)*abs(c-a));
  if(EQ(val,1))return 0;
  if(EQ(val,-1))return PI;
  D res =  acos(val);
  return cross(b-a,c-a)<-EPS?2*PI-res:res;
}

//for line(segment)
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 (abs(b)+EPS<abs(c)) return -2;   //a--b--c on line
  return 0;                       //on segment
}

inline bool para(L a,L b){return abs(cross(a.fs-a.sc,b.fs-b.sc))<EPS;}

inline P line_cp(L a,L b){
  return a.fs+(a.sc-a.fs)*cross(b.sc-b.fs,b.fs-a.fs)/cross(b.sc-b.fs,a.sc-a.fs);
}

inline D seg_p_dis(L a,P x){
  if(dot(a.sc-a.fs,x-a.fs)<EPS)return abs(x-a.fs);
  if(dot(a.fs-a.sc,x-a.sc)<EPS)return abs(x-a.sc);
  return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);
}

//for circle
inline bool in_cir(C c,P x){return (abs(x-c.fs) +EPS < c.sc);}
inline bool on_cir(C c,P x){return EQ(abs(x-c.fs),c.sc);}

inline vector<P> cp_cir_to_line(C a, L l){
  vector<P> v;
  P n = norm(l.fs-l.sc).fs;
  P p = line_cp(l,L(a.fs,a.fs+n));

  if(on_cir(a,p))v.pb(p);
  else if(in_cir(a,p)){
    D d = abs(a.fs-p);
    D len = sqrt(a.sc*a.sc - d*d);
    P cp_vec = len * unit(l.fs-l.sc);
    v.pb(p + cp_vec);
    v.pb(p - cp_vec);
  }
  return v;
}

inline bool is_cp_cir_seg(C c, L s){
  D dis = seg_p_dis(s, c.fs);
  return (dis+EPS<c.sc);
}

struct kururin{
  P A,B,S;
  D rem_seta;
  kururin(P a=P(0,0), P b=P(0,0), P c=P(0,0), D r=0)
    :A(a),B(b),S(c),rem_seta(r){}
  void rot(D seta, P support){
    if(rem_seta < seta+EPS)seta = rem_seta;
    
    if(!EQ(A,S))A = S + rotate(A-S,2*PI-seta);
    if(!EQ(B,S))B = S + rotate(B-S,2*PI-seta);
    S = support;
    rem_seta -= seta;
  }
};

struct sup{
  D angle;
  P point;
  sup(D a=0,P p=P(0,0)):angle(a),point(p){}
  bool cmp(const sup &s,const P &c){
    if(!EQ(angle,s.angle))return angle<s.angle;
    return abs(point-c)>abs(s.point-c);
  }
};

int main(){
  D l,r,x,y;
  int n;

  while(cin >> l >> r >> n, n){
    kururin kuru(P(0,0),P(0,l),P(0,0),2*PI*r);

    Poly walls;
    rep(i,n){
      cin >> x >> y;
      walls.pb(P(x,y));
    }
    vector<L> vl;
    rep(i,n)vl.pb(L(walls[i],walls[(i+1)%n]));

    while(!EQ(kuru.rem_seta,0)){
      sup min_sup = sup(2*PI,kuru.S);

      if(!EQ(kuru.A,kuru.S)){
	C c = C(kuru.S,abs(kuru.A-kuru.S));
	rep(i,n){
	  if(is_cp_cir_seg(c,vl[i])){
	    vector<sup> angles;

	    vector<P> cp = cp_cir_to_line(c,vl[i]);
	    cp.pb(vl[i].fs); cp.pb(vl[i].sc);
	    sort(all(cp));
	    cp.erase(unique(all(cp)),cp.end());

	    rep(j,cp.sz){
	      if(ccw(vl[i].fs,vl[i].sc,cp[j])==0
		 && (in_cir(c,cp[j]) || on_cir(c,cp[j])) ){
		if(EQ(kuru.S,cp[j]))angles.pb(sup(2*PI, cp[j]));
		else{
		  angles.pb(sup(2*PI-arg(kuru.S,kuru.A,cp[j]),cp[j]));
		  if(EQ(angles.back().angle,2*PI))angles.back().angle = 0;
		}
	      }
	    }
	    
	    if(angles[1].cmp(angles[0],kuru.S))swap(angles[0],angles[1]);

	    if(EQ(angles[0].angle,0)){
	      if(para(vl[i], L(kuru.A,kuru.S))){
		if(dot(vl[i].sc-vl[i].fs, kuru.A-kuru.S) > EPS)min_sup = sup(0,kuru.S);
		else if(EQ(angles[1].angle,PI) && angles[1].cmp(min_sup,kuru.S)){
		  min_sup = angles[1];
		}
	      }else if(angles[1].angle>PI+EPS){
		if(angles[1].cmp(min_sup,kuru.S))min_sup = angles[1];
	      }else min_sup = angles[0];
	    }else if(angles[0].cmp(min_sup,kuru.S))min_sup = angles[0];
	  }
	}
      }

      if(!EQ(kuru.B,kuru.S)){
	C c = C(kuru.S,abs(kuru.B-kuru.S));
	rep(i,n){
	  if(is_cp_cir_seg(c,vl[i])){
	    vector<sup> angles;

	    vector<P> cp = cp_cir_to_line(c,vl[i]);
	    cp.pb(vl[i].fs); cp.pb(vl[i].sc);
	    sort(all(cp));
	    cp.erase(unique(all(cp)),cp.end());
	      
	    rep(j,cp.sz){
	      if(ccw(vl[i].fs,vl[i].sc,cp[j])==0
		 && (in_cir(c,cp[j]) || on_cir(c,cp[j])) ){
		if(EQ(kuru.S,cp[j]))angles.pb(sup(2*PI, cp[j]));
		else{
		  angles.pb(sup(2*PI-arg(kuru.S,kuru.B,cp[j]),cp[j]));
		  if(EQ(angles.back().angle,2*PI))angles.back().angle = 0;
		}
	      }
	    }
	  
	    if(angles[1].cmp(angles[0],kuru.S))swap(angles[0],angles[1]);

	    if(EQ(angles[0].angle,0)){
	      if(para(vl[i], L(kuru.B,kuru.S))){
		if(dot(vl[i].sc-vl[i].fs, kuru.B-kuru.S) > EPS)min_sup = sup(0,kuru.S);
		else if(EQ(angles[1].angle,PI) && angles[1].cmp(min_sup,kuru.S)){
		  min_sup = angles[1];
		}
	      }else if(angles[1].angle>PI+EPS){
		if(angles[1].cmp(min_sup,kuru.S))min_sup = angles[1];
	      }else min_sup = angles[0];
	    }else if(angles[0].cmp(min_sup,kuru.S))min_sup = angles[0];
	  }
	}

      }

      if(EQ(min_sup.angle,0))break;
      kuru.rot(min_sup.angle,min_sup.point);
    }
    cout << fixed << setprecision(8)
	 << kuru.A.real() << " " << kuru.A.imag() << endl;
  }
}

Measured memory_bytes: 1348