Horse tied outside the castle

Given a convex polygon and an exterior point with rope length L, compute the area reachable when the rope bends around polygon vertices and the two wrapping directions do not overlap.

Hard8GeometryMathImplementationNo attempts yetTime limit0.1sMemory limit16 MB

Problem

The castle wall is a convex polygon with NN vertices. A tree stands outside the wall at the integer coordinates (X,Y)(X, Y), and a knight ties his horse to that tree with a rope of length LL.

The horse cannot enter the castle, and the rope cannot pass through the wall. When the rope catches on a corner of the wall it bends at that vertex, so the horse walks around the castle as long as the rope reaches.

The horse reaches a point PP outside the castle exactly when the shortest path from the tree to PP that avoids the interior of the castle has length at most LL.

Compute the area of the region the horse reaches.

Input

The first line contains the coordinates of the tree, XX and YY, and the length of the rope LL, separated by spaces. The second line contains the number of vertices NN. Each of the next NN lines contains two integers XiX_i and YiY_i, the vertices of the polygon in clockwise order.

Output

Print the area of the region the horse reaches, rounded to exactly five digits after the decimal point. For an area of π\pi, print 3.14159.

Constraints

  • 3N3003 \le N \le 300
  • 10000Xi,Yi10000-10000 \le X_i, Y_i \le 10000
  • 10000X,Y10000-10000 \le X, Y \le 10000
  • 1L1000001 \le L \le 100000
  • All coordinates are integers.
  • The polygon is convex, and no three vertices lie on one line.
  • The tree is outside the castle. It is never inside the wall or on it.
  • Let SS be the perimeter of the convex hull of the NN vertices together with the tree. Then 2L<S2L < S, so the region the horse reaches by going around the castle to the left never overlaps the region it reaches by going around to the right.