#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 all(a) (a).begin(),(a).end()
#define fs first
#define sc second
#define pb push_back
#define sz size()

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);
const P axis[] = { P(0,1), P(1,0), P(0,-1), P(-1,0) };

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) );
}

inline D arg(P a,P b,P c){
  if(EQ(b,c))return 0;
  return acos(dot(b-a,c-a)/(abs(b-a)*abs(c-a)));
}
inline D arg(D a,D b,D c){
  if(EQ(b,0) || EQ(c,0))return 0;
  return acos( (b*b+c*c-a*a)/(2*b*c) );
}

inline 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 D line_dis(L a,P x){return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);}

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 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 vector<P> cp_cir_to_seg(C a, L l){
  vector<P> v,tmp = cp_cir_to_line(a,l);
  rep(i,tmp.sz)if(!ccw(l.fs,l.sc,tmp[i]))v.pb(tmp[i]);
  return v;
}

//straight move
inline P straight_move(const C &c, const Poly &p , const int &dir, const P &origin){
  int n = p.sz;
  P vec = axis[dir];
  D len = 1e5;

  pair<P,P> side = norm(vec);
  P a =  c.fs + side.fs*c.sc, b = c.fs + side.sc*c.sc;

  rep(i,n){
    if(ccw(a,a+vec,p[i]) == -1 && ccw(b,b+vec,p[i]) == 1 && ccw(a,b,p[i]) == 1){
      D w = cross(vec,p[i]-c.fs);
      len = min(len, dot(vec,p[i]-c.fs) -  sqrt(c.sc*c.sc-w*w));
    }

    L l = L(p[i], p[(i+1)%n]);
    
    if(ccw(l.fs,l.sc,origin) == 0){
      if(EQ(l.sc,origin))continue;
      len = min(len, abs(l.sc-origin));
    }else{
      if(ccw(c.fs, c.fs+vec, l.sc) == 1 && ccw(c.fs, a, l.sc) == -1 &&
	 ccw(c.fs, c.fs+vec, l.fs) == -1 && ccw(c.fs, b, l.fs) == 1){
	len = min(len, line_dis(l,c.fs) - c.sc);
      }
    }
  }

  return c.fs + len*vec;
}

//rotate at one point
inline P rotate_circle(const C &c, const Poly &p, const P &origin){
  D seta = PI/2;
  int n = p.sz;
  //orthogonal
  rep(i,n){
    if(EQ(p[i],origin)){
      P nv = norm(p[(i+1)%n]-p[i]).fs+origin, cenv = c.fs;
      seta = min(seta,arg(origin,cenv,nv));
    }
  }

  //collide a point
  rep(i,n){
    if(EQ(origin,p[(i+n-1)%n]) || EQ(origin,p[i]) || EQ(origin,p[(i+1)%n]))continue;
    D dis = abs(origin-p[i]);

    if(dis+EPS < 2*c.sc){  
      D z = sqrt(4*c.sc*c.sc - dis*dis);
      if(cross(c.fs-origin, p[i]-origin)>-EPS)continue;
      seta = min(seta, arg(origin,c.fs,p[i]) - arg(z,2*c.sc,dis));
    }
  }

  //collied an edge
  rep(i,n){
    L l = L(p[i],p[(i+1)%n]);
    P cp = line_cp(l,L(c.fs, c.fs+norm(l.fs-l.sc).fs));
    if(EQ(cp,c.fs))continue;
    P add = c.sc * unit(c.fs-cp);
    l.fs += add; l.sc += add;

    C o = C(origin,c.sc);
    vector<P> vp = cp_cir_to_line(o,l);
    rep(j,vp.sz){
      if(cross(c.fs-origin, vp[j]-origin)>-EPS)continue;
      if(dot(c.fs-origin,vp[j]-origin)<EPS)continue;
      P nxt = vp[j] - add;
      if(ccw(p[i],p[(i+1)%n],nxt))continue;
      seta = min(seta, arg(origin,c.fs,vp[j]));
    }
  }
  
  P rot = rotate(c.fs-origin, -seta);
  return rot+origin;
}

//cross check
inline vector<P> cross_check(const C &c, const Poly &p){
  vector<P> res;
  int n = p.sz;
  rep(i,n){
    L l = L(p[i],p[(i+1)%n]);
    vector<P> tmp = cp_cir_to_seg(c,l);
    for(P x : tmp){
      if(!EQ(x,p[i]))res.pb(x);
    }
  }  
  return res;
}

//sort points by their angle from center of circle
inline vector<P> sortarg(const C &c, const P &origin, const vector<P> &list){
  int n = list.sz;
  vector< pair<D,int> > tmp(n);
  rep(i,n){
    tmp[i] = make_pair(arg(c.fs, origin, list[i]), i);
  }
  sort(all(tmp));

  vector<P> res(n);
  rep(i,n)res[i] = list[tmp[i].second];
  return res;
}

//polygon area
inline D area(const Poly &p){
  int n = p.sz;
  if(n<3)return 0;
  D res = 0;
  rep(i,n)res += cross(p[i],p[(i+1)%n]);
  return res/2;
}

inline D curve(const C &c, P p1, P p2){
  p1 -= c.fs; p2 -= c.fs;
  D tri = cross(p1, p2)/2;
  D seta = acos(dot(p1,p2)/(abs(p1)*abs(p2)));
  return c.sc*c.sc*seta/2 - tri;
}

//simulate roomba moves
inline D simulate( C c, const Poly &p ){
  int n = p.sz;
  Poly trajectry;
  c.fs = straight_move(c,p,0,c.fs);
  P adj = P(c.fs.real(), c.fs.imag() + c.sc), start_cen = P(1e9,1e9);

  D res = 0;
  for(int cnt=0;;cnt++){
    vector<P> list = cross_check(c,p);
    list = sortarg(c,adj,list);
     P nxt = list.back();
    
    if(cnt>0){
      if(EQ(start_cen,c.fs))break;
      
      trajectry.pb(list[0]);
      if(list.sz>1){
	trajectry.pb(list.back());
	res += curve(c,list[0],list.back());
      }
    }
    if(cnt==1)start_cen = c.fs;

    int d = -1;
    rep(i,n){
      P a = p[i], b = p[(i+1)%n];
      if(ccw(a,b,nxt) == 0 && EQ(cross(norm(b-a).fs,c.fs-nxt),0) && !EQ(b,nxt)){
	rep(j,4){
	  if(dot(axis[j],b-a)>EPS)d = j;
	}
      }
    }

    if(d<0){
      c.fs = rotate_circle(c,p,nxt);
      adj = nxt;
    }else{
      P rel_adj = nxt-c.fs;
      c.fs = straight_move(c,p,d,nxt);
      adj = rel_adj + c.fs;
    }
  }

  return res + area(trajectry);
}

int main(){
  int n,x,y,r;
  while(cin >> n >> x >> y >> r){
    if(n==0)break;

    C c = C(P(x,y),r);
    Poly p(n);
    rep(i,n){
      cin >> x >> y;
      p[i] = P(x,y);
    }

    cout << fixed << setprecision(10) << simulate(c,p) << endl;
  }
}

Measured memory_bytes: 1300