#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
#define double long double
const double EPS = 1e-8;
const double PI = acos(-1);
typedef long long ll;
typedef pair<int,int> pii;

typedef complex<double> P;
P pIN() { double x,y; cin >> x >> y; return P(x,y); }
namespace std {
  bool operator < (const P& a, const P& b) {
    // if (abs(a-b)<EPS) return 0;
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L() { resize(2); }
};
typedef vector<P> G;
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 (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool parallel(const L &l, const L &m) {
  return abs(cross(l[1]-l[0],m[1]-m[0])) < EPS;
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}

bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}
P reflection(const L &l, const P &p) {
  return p + P(2,0) * (projection(l, p) - p);
}
double distanceLP(const L &l, const P &p) {
  return abs(p - projection(l, p));
}
double distanceLL(const L &l, const L &m) {
  return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(const L &l, const L &s) {
  if (intersectLS(l, s)) return 0;
  return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
P nearestSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return r;
  double a1 = abs(s[0] - p);
  double a2 = abs(s[1] - p);
  if (a1 < a2) return s[0];
  else return s[1];
}
double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

// テ」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ョテ・ツ崢榲ィツサツ「
P rotate(const P &p, double ang) {
  return p * P(cos(ang), sin(ang));
}
// テ・ツ篠淌ァツつケテ・ツ堕ィテ」ツつ甘」ツ?ョテァツ崢エテァツキツ堙」ツ?ョテ・ツ崢榲ィツサツ「
L rotate(const L &l, double ang) {
  return L(rotate(l[0], ang),rotate(l[1], ang));
}
bool EQ(double a, double b) {
  return abs(a-b) < EPS;
}

vector<P> circleCentersFromTangent(L l1, L l2, double r) {
  vector<P> res;
  if (parallel(l1,l2)) return res;
  P cp = crosspoint(l1,l2);
  l1[0]-=cp; l1[1]-=cp;
  l2[0]-=cp; l2[1]-=cp;
  double ang = arg(l1[1]-l1[0]);
  l2 = rotate(l2, -ang+PI/2);
  double A = (l2[1]-l2[0]).imag() / (l2[1]-l2[0]).real();
  double sq = sqrt(A*A+1);
  res.push_back(P(r, r*(sq+A)));
  res.push_back(P(-r, r*(sq-A)));
  res.push_back(P(r, r*(-sq+A)));
  res.push_back(P(-r, r*(-sq-A)));  
  FOR(it, res) *it = rotate(*it,+ang-PI/2) + cp;
  return res;
}

vector<P> circleCentersFromPoints(const P &p1, const P &p2, double r) {
  vector<P> res;
  double len = abs(p1-p2);
  if (len < EPS) return res;
  if (len/2 >= r-EPS) return res;
  P v = p2-p1;
  v /= len;
  v *= sqrt(r*r-(len/2)*(len/2));
  P p = (p1+p2)*P(0.5,0);
  res.push_back(p+v*P(0,1));
  res.push_back(p+v*P(0,-1));
  return res;
}

void solve(vector<P> &v, double A, double B, double C, double x) {
  double D = B*B-4*A*C;
  if (D<0) return;
  double sqD = sqrt(max(D,(double)0.0));
  v.push_back(P(x, (-B+sqD)/(2*A)));
  v.push_back(P(x, (-B-sqD)/(2*A)));
}

vector<P> circleCentersFromTangentAndPoint(L l, P p, double r) {
  vector<P> res;
  P cp = l[0];
  l[1] -= cp; l[0] -= cp;
  p -= cp;
  double ang = arg(l[1]-l[0]);
  p = rotate(p, -ang+PI/2);
  double a = p.real();
  double b = p.imag();
  double A = 1;
  double B = -2*b;
  solve(res,A,B,b*b-2*r*a+a*a, r);
  solve(res,A,B,b*b+2*r*a+a*a, -r);
  FOR(it, res) *it = rotate(*it,+ang-PI/2) + cp;
  return res;
}

vector<P> circleCentersFromSegments(L s1, L s2, double r) {
  vector<P> tmp = circleCentersFromTangent(s1,s2,r);
  vector<P> res;
  FOR(it, tmp) {
    if (intersectSP(s1,projection(s1,*it)) &&
        intersectSP(s2,projection(s2,*it))) {
      res.push_back(*it);
    }
  }
  REP(i,2) {
    REP(j,2) {
      vector<P> tmp = circleCentersFromPoints(s1[i],s2[j],r);
      FOR(it, tmp) {
        res.push_back(*it);
      }
    }
  }
  REP(i,2) {
    vector<P> tmp1 = circleCentersFromTangentAndPoint(s1, s2[i], r);
    FOR(it, tmp1) {
      if (intersectSP(s1, projection(s1,*it))) {
        res.push_back(*it);
      }
    }
    vector<P> tmp2 = circleCentersFromTangentAndPoint(s2, s1[i], r);
    FOR(it, tmp2) {
      if (intersectSP(s2, projection(s2,*it))) {
        res.push_back(*it);
      }
    }
  }
  return res;
}

vector<P> endpointCircles(const L &l, double r) {
  P v = l[1]-l[0];
  v /= abs(v);
  v *= r;
  vector<P> res;
  res.push_back(l[0] + v * P(0,1));
  res.push_back(l[0] + v * P(0,-1));
  res.push_back(l[1] + v * P(0,1));
  res.push_back(l[1] + v * P(0,-1));
  return res;
}

double scale = 2;
// P diff(-90, 30);
P diff(300, 300);
void outputLine(L l) {
  return;
  l[0] = l[0]*P(scale,0)+diff;
  l[1] = l[1]*P(scale,0)+diff;
  printf("line(%Lf,%Lf,%Lf,%Lf);\n",l[0].real(),l[0].imag(),l[1].real(),l[1].imag());  
}
void outputCircle(C c) {
  return;
  c.p = c.p*P(scale,0) + diff;
  c.r *= scale;
  printf("circle(%Lf,%Lf,%Lf);\n", c.p.real(), c.p.imag(), c.r);
}
inline L line(const G &g, int i) {
  return L(g[i], g[(i+1)%g.size()]);
}

bool isVisible(const P &p1, const P &p2, const G &g, double r) {
  L seg(p1,p2);
  REP(i,g.size()) {
    if (distanceSS(seg,line(g,i)) <= r-EPS) return 0;
  }
  return 1;
}

double angle(const P &a, const P &b) {        // テ」ツδ凖」ツつッテ」ツδ暗」ツδォテッツスツ?」ツ?凝」ツつ嘉」ツ?ソテ」ツ?淌」ツδ凖」ツつッテ」ツδ暗」ツδォテッツスツづ」ツ?ョティツァツ津・ツコツヲテ」ツ?ョティツィツ暗ァツョツ夕0,2pi)
  double ret = arg(b)-arg(a);
  return (ret>=0) ? ret : ret + 2*PI;
}
double angle2(const P &a, const P &b) { // テ」ツδ凖」ツつッテ」ツδ暗」ツδォaテ」ツ?ィテ」ツδ凖」ツつッテ」ツδ暗」ツδォbテ」ツ?ョテゥツ鳴禿」ツ?ョティツァツ津・ツコツヲ
  return min(angle(a,b), angle(b,a));
}

bool collide(const P &cent, const P &p1, const P &p2, const L seg, double r) {
  vector<P> v(2);
  v[0] = seg[0], v[1] = seg[1];
  if (intersectLS(L(cent,p1),seg)) {
    P cp = crosspoint(L(cent,p1),seg);
    v.push_back(cp);
  }
  if (intersectLS(L(cent,p2),seg)) {
    v.push_back(crosspoint(L(cent,p2),seg));
  }
  sort(ALL(v));
  REP(i,v.size()-1) {
    if (abs(v[i]-v[i+1])<EPS) continue;
    P p = (v[i]+v[i+1])*P(0.5,0);
    if (angle(p1-cent, p-cent) <= angle(p1-cent, p2-cent)) {
      if (distanceSP(L(v[i],v[i+1]), cent) <= r) {
        // cout << "NG" << " " << distanceSP(L(v[i],v[i+1]), cent) << endl;
        // cout << p << " " << p1 << " " << angle(p1-cent, p-cent) << endl;
        // cout << v[i] << " " << v[i+1] << " " << cent << endl;
        return 1;
      }
    }
  }
  return 0;
}

bool canRound2(const P &cent, const P &p1, const P &p2, const G &g, double r) {
  REP(i,g.size()) {
    if (collide(cent,p1,p2,line(g,i),r)) return 0;
  }
  return 1;
}

bool canRound(const P &p1, const P &p2, const G &g, double r, const vector<P> &ps) {
  REP(i,g.size()) {
    if (EQ(abs(p1-g[i]), r) &&
        EQ(abs(p2-g[i]), r)) {
      
      P a = g[i]+(p1-g[i])*P(2,0);
      P b = g[i]+(p2-g[i])*P(2,0);
      if (canRound2(g[i],b,a,g,2*r)) swap(a,b);
      if (canRound2(g[i],a,b,g,2*r)) {
        FOR(it, ps) {
          if (abs(p1-*it)<EPS || abs(p2-*it)<EPS) continue;
          if (EQ(abs(*it-g[i]), r)) {
            if (angle(a-g[i],*it-g[i]) < angle(a-g[i],b-g[i])) return 0;
          }
        }
        return 1;
      }
    }
  }
  return 0;
}

// テァツつケ-テ・ツ、ツ堙ィツァツ津・ツスツ「テ・ツ個?・ツ青ォテゥツ鳴「テ、ツソツ?
int contains(const G &g, const P &p) {
  bool in = 0;
  REP(i,g.size()) {
    P a = g[i] - p;
    P b = g[(i+1)%g.size()] - p;
    if (imag(a) > imag(b)) swap(a,b);
    if (imag(a) <= 0 && 0 < imag(b))
      if (cross(a,b) < 0) in = !in;
    if (abs(cross(a,b))< EPS && dot(a,b) <= EPS) return 0;
  }
  return in?1:-1;
}

bool check(const P &p, const G &g, double r) {
  if (contains(g,p) != 1) return 0;
  REP(i,g.size()) {
    if (distanceSP(line(g,i), p) <= r-EPS) return 0;
  }
  return 1;
}

G getCycle(const vector<vector<int> > &g, const vector<P> &ps, int a, int b) {
  vector<int> flag(g.size(), -1);
  G tmpres;
  int pre = a;
  int cur = b;
  tmpres.push_back(ps[a]);
  flag[a] = 0;
  int cnt = 1;
  while(1) {
    if (flag[cur] >= 0) {
      G res;
      for (int i=flag[cur]; i<tmpres.size(); ++i) {
        res.push_back(tmpres[i]);
      }
      return res;
    }
    flag[cur] = cnt++;
    tmpres.push_back(ps[cur]);
    P vec = ps[pre]-ps[cur];
    if (cnt == 2) {
      vec = ps[cur]-ps[pre];
    }
    double minang = INF;
    int dst = -1;
    FOR(it, g[cur]) {
      double tang = angle(vec, ps[*it]-ps[cur]);
      if (tang > EPS && chmin(minang, tang)) {
        dst = *it;
      } else if (EQ(minang,tang) && abs(ps[*it]-ps[cur])<abs(ps[dst]-ps[cur])) {
        dst = *it;
      }
      // cout << ps[cur] << " " << ps[*it] << endl;
    }
    // cout << dst << " " << minang << " " << ps[dst] << endl;
    if (dst == -1) return G();
    pre = cur;
    cur = dst;
  }
}
double area(const G& g) {
  double A = 0;
  for (int i = 0; i < g.size(); ++i) {
    A += cross(g[i], g[(i+1)%g.size()]);
  }
  return abs(A/2);
}

P O;
int quadrant(const P &a) {      // テヲツ卍づィツィツ暗・ツ崢榲」ツつ甘・ツ?エテ」ツ?ッテ・ツ青ォテ」ツ?ソテ」ツ??・ツ債甘ヲツ卍づィツィツ暗・ツ崢榲」ツつ甘・ツ?エテ」ツ?ッテ・ツ青ォテ」ツ?セテ」ツ?ェテ」ツ??
  if (a.real() > 0 && a.imag() >= 0) return 0;
  if (a.real() <= 0 && a.imag() > 0) return 1;
  if (a.real() < 0 && a.imag() <= 0) return 2;
  return 3;
}
bool cmpAngle(const P &a, const P&b) { // テ」ツδュテ」ツδ静」ツつケテ」ツδ暗」ツ?ェティツァツ津・ツコツヲテヲツッツ氾ィツシツ?
  int q1 = quadrant(a-O);
  int q2 = quadrant(b-O);
  if (q1 != q2) return q1 < q2;
  return cross(a-O,b-O)>0;
}


map<pair<P,P>, bool> mp;

double cornerArea(const P &p, const G &g, double r) {
  vector<P> ps;
  REP(i,g.size()) {
    L s = line(g,i);
    // P p1 = 
    // // L s(g[i],g[(i+1)%g.size()]);
    //L s(P(0,0),P(100,100));
    if (EQ(distanceSP(s,p), r)) {
      P q = nearestSP(s,p);
      // P p(0,0);
      bool f = 1;
      REP(j,ps.size()) {
        if (abs(ps[j]-q) < EPS) f = 0;
      }
      if (f) {
        ps.push_back(q);
      }
    }
  }
  O = p;
  sort(ALL(ps), cmpAngle);
  if (ps.size() <= 1) return 0;
  int cur = 0;
  double res = 0;
  G tmp;
  // cout << p << endl;
  for (int i=0; ; ++i) {
    if (cur == ps.size()+1) {
      // cout << res << endl;
      return res;
    }
    int ii = i%g.size();
    L s = line(g,ii);
    tmp.push_back(g[ii]);
    P cp = ps[cur%ps.size()];    
    if (intersectSP(s,cp)) {
      if (cur && angle(ps[cur-1]-p,cp-p) <= PI) {
        tmp.push_back(cp);
        tmp.push_back(p);
        // cout << p << " " << ps[cur-1] << " " << cp << " " << cur << " " << ps[cur%ps.size()] << endl;
        // FOR(it, tmp) cout << *it << " "; cout << endl;
        // cout << tmp.size() << endl;
        // REP(k,tmp.size()){
        //   outputLine(line(tmp,k));
        // }
        if (mp.count(make_pair(ps[cur-1],ps[cur%ps.size()])) == 0) {
          mp[make_pair(ps[cur-1],ps[cur&ps.size()])] = 1;
          res += area(tmp);
          res -= r*r*angle(ps[cur-1]-p,cp-p)/2;
        }
      }
      tmp.clear();
      tmp.push_back(cp);
      cur++;
    }
  }
}


int main() {
  outputLine(L(P(-1000,0),P(1000,0)));
  outputLine(L(P(-0,-1000),P(0,1000)));
  // L l1(P(100, 200), P(1000,500));
  // L l2(P(100, 300), P(700,300));
  // // L l1(P(0, 0), P(300,300));
  // // L l2(P(0, 0), P(700,300));
  
  // double r = 30;
  // vector<P> res = circleCentersFromTangent(l1,l2,r);
  // outputLine(l1);
  // outputLine(l2);
  // FOR(it, res) {
  //   outputCircle(C(*it, r));
  // }
  int n;
  double x,y,r;
  while(cin>>n>>x>>y>>r, n) {
    mp.clear();
    G poly;
    REP(i,n) poly.push_back(pIN());

    // move right(?)
    double minDist = INF;
    P right;
    P start(x,y);
    REP(i,n) {
      L l(start-P(0,r), P(x+1000,y-r));
      vector<P> tmp = circleCentersFromSegments(l, line(poly,i), r);
      FOR(it, tmp) {
        if (check(*it, poly, r)) {
          double dis = abs(*it-start);
          if (chmin(minDist, dis)) {
            right = *it;
          }
        }
      }
    }
    
    vector<P> ps;
    ps.push_back(start);
    ps.push_back(right);
    
    REP(i,n) {
      vector<P> tmp = endpointCircles(line(poly,i),r);
      FOR(it, tmp) {
        if (check(*it, poly, r))
          ps.push_back(*it);
      }
      REP(j,i) {
        vector<P> ret = circleCentersFromSegments(line(poly,i),line(poly,j),r);
        FOR(it, ret) {
          if (check(*it, poly, r)) {
            ps.push_back(*it);
          }
        }
      }
    }
    REP(i,n) {
      outputLine(line(poly,i));
    }
    vector<P> tmpps;
    REP(i,ps.size()) {
      bool ok = 1;
      REP(j,tmpps.size()) {
        if (abs(tmpps[j]-ps[i])<EPS) {
          ok = 0;
          break;
        }
      }
      if (ok)
        tmpps.push_back(ps[i]);      
    }
    ps = tmpps;
    // sort(ALL(ps));
    // ps.erase(unique(ALL(ps)), ps.end());

    int N = ps.size();

    int startID = -1;
    int rightID = -1;
    REP(i,N) {
      // cout << ps[i] << endl;
      if (EQ(abs(start-ps[i]),0)) startID = i;
      if (EQ(abs(right-ps[i]),0)) rightID = i;
    }
    
    vector<vector<int> > g(N);
    REP(i,N) {
      if (i != startID && i != rightID)
        outputCircle(C(ps[i],r));
      REP(j,i) {
        if (isVisible(ps[i], ps[j], poly, r) || canRound(ps[i], ps[j], poly, r, ps)) {          
          g[i].push_back(j);
          g[j].push_back(i);
          // outputLine(L(ps[i],ps[j]));
        }
      }
    }

    
    G cycle = getCycle(g, ps, startID, rightID);
    double ans = area(poly);
    REP(i,cycle.size()) {
      outputLine(line(cycle,i));
      L l1 = line(cycle,i);
      L l2 = line(cycle,(i+1)%cycle.size());
      // if (ccw(l1[0],l1[1],l2[1]) == 1) {
        ans -= cornerArea(l1[1],poly,r);
        // }
    }
    printf("%.10Lf\n", ans);
  }
}

Measured memory_bytes: 1332