#include <bits/stdc++.h>
using namespace std;

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

const double INF = 1e+8;
const double EPS = 1e-8;

struct Circle{
  P c;
  double r;
  Circle(P c=P(0,0), double r=0):c(c),r(r){}
};

typedef Circle Side;

bool equal(double a, double b){ return fabs(a-b) < EPS;}
bool equal(P a, P b){ return fabs(real(a-b)) < EPS && fabs(imag(a-b)) < EPS;}

double dot(P a, P b){ return real(conj(a)*b); }

double cross(P a, P b){ return imag(conj(a)*b); }

P proj(P p, L l){
  return l.first + dot(p - l.first, l.second - l.first) / norm(l.second - l.first) * (l.second - l.first);
}

P rotate(P p, double rad){
  double x = real(p) * cos(rad) - imag(p) * sin(rad);
  double y = real(p) * sin(rad) + imag(p) * cos(rad);
  return P(x,y);
}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersectSP(L s, P p){ 
  return abs(s.first-p) + abs(s.second-p) - abs(s.second-s.first) < EPS; 
}

bool isIntersect(L s1, L s2){
  
  //ccw ??????????????????????????¨, ????????????????????´?????????????????¨??????????????????????????????
  if(max(real(s1.first), real(s1.second)) + EPS < min(real(s2.first), real(s2.second)) ||
     max(imag(s1.first), imag(s1.second)) + EPS < min(imag(s2.first), imag(s2.second)) ||
     max(real(s2.first), real(s2.second)) + EPS < min(real(s1.first), real(s1.second)) ||
     max(imag(s2.first), imag(s2.second)) + EPS < min(imag(s1.first), imag(s1.second))) return false;

  if(isIntersectSP(s1, s2.first) || isIntersectSP(s1, s2.second) || isIntersectSP(s2, s1.first) || isIntersectSP(s2, s1.second)) return false;

  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

vector<P> getIntersectCS(Circle c, L s){
  vector<P> res;
  P h = proj(c.c, s);
  double d = abs(c.c - h);
  if(d > c.r + EPS);
  else if(d > c.r - EPS){
    if(isIntersectSP(s,h)) res.push_back(h);
  }
  else {
    P v = s.second - s.first;
    v = (sqrt(c.r*c.r - d*d) / abs(v)) * v;
    if(isIntersectSP(s, h+v)) res.push_back(h+v);
    if(isIntersectSP(s, h-v)) res.push_back(h-v);
  }
  return res;
}

enum {OUT, BORDER, IN};
int contains(vector<P> v, P p){ 
  bool in = false; 
  for(int i=0;i<v.size();i++){ 
    P a = v[i] - p; 
    P b = v[(i+1)%v.size()] - p; 
    if(imag(a) > imag(b)) swap(a,b); 
    if(imag(a) <= EPS && EPS < imag(b)) 
      if(cross(a,b) < -EPS) in = !in; 
    if(equal(cross(a,b), 0.0) && dot(a,b) < EPS) return 1; 
  } 
  return in ? 2 : 0; 
}


double l, r;
int n;
vector<P> v;

bool cross_wall(L l){
  for(int i=0;i<n;i++){
    if(isIntersect(l, L(v[i], v[(i+1)%n]))) return true;
  }
  return contains(v, (l.first + l.second) / 2.0) == OUT;
}

double calc_arg(Circle cir, P next, P cen){
  P prev = cir.c;
  double a1 = arg(prev - cen);
  double a2 = arg(next - cen);
  if(a1 < a2 + EPS) a1 += 2.0 * M_PI;
  return a1 - a2;
}

/*
  ???????????§?¨?????????¢???????????¢?§????????????????????????????????????¨??????????????¢????????£???????????\??¬????????§???
  ?¬?????????????????£???????????§??????????????????????????°?????????????????????????????????????????????´??????????????¨?????????????????¢?????????????????????????????????
 */
P solve(){
  Side side[2] = {Circle(P(0,0), 0), Circle(P(0,l), l)}; // ??????
  double theta = M_PI / 2.0; // ?§?????§????
  P cen = P(0,0), prev_cen = P(0,0); // ???

  r *= 2.0 * M_PI;
  r = M_PI / 2.0 - r;

  while(r < theta - EPS){
    P next;
    double move = theta - r;
    for(int i=0;i<2;i++){
      double len = 0;
      if(equal(side[i].r, 0.0)) continue;

      // ?§???¨??¶???????????´???
      for(int j=0;j<n;j++){
        if(abs(cen - v[j]) > side[i].r + EPS || cross_wall(L(cen, v[j])) || isIntersectSP(L(side[0].c, side[1].c), v[j]) || equal(v[j], prev_cen) || equal(v[j], cen)) continue;
        double res_arg = calc_arg(side[i], v[j], cen);
        if(move < res_arg - EPS || equal(move, res_arg) && len > abs(cen - v[j]) - EPS) continue;
        move = res_arg;
        len = abs(cen - v[j]);
        next = v[j];
      }

      // ?????¨??¶???????????´???
      for(int j=0;j<n;j++){
        vector<P> cs = getIntersectCS(Circle(cen, side[i].r), L(v[j], v[(j+1)%n]));
        for(int k=0;k<cs.size();k++){
          if(cross_wall(L(cen, cs[k])) || equal(cs[k], prev_cen)) continue;
          double res_arg = calc_arg(side[i], cs[k], cen);
          if(move < res_arg - EPS || equal(move, res_arg) && len > abs(cen - cs[k]) - EPS) continue;
          move = res_arg;
          len = abs(cen - cs[k]);
          next = cs[k];
        }
      }

    }

    // ??????????????´???
    if(equal(move, 0.0)) return side[0].c;
    
    // ?????¢?§??????????????????????????????´???
    for(int i=0;i<2;i++){ 
      P pp = rotate(side[i].c - cen, -move/2.0) + cen;
      if(side[i].r > EPS && contains(v, pp) == OUT) return side[0].c;
    }

    // ??´??°
    for(int i=0;i<2;i++) {
      side[i].c = rotate(side[i].c - cen, -move) + cen;
      side[i].r = abs(next - side[i].c);
    }
    prev_cen = cen;
    cen = next;
    theta -= move;
  }


  return side[0].c;
}

int main(){
  double x, y;
  while(cin >> l >> r >> n && n){
    v.clear();
    for(int i=0;i<n;i++){
      cin >> x >> y;
      v.push_back(P(x, y));
    }
    P ans = solve();
    printf("%.10f %.10f\n", real(ans), imag(ans));
  }
}