The castle wall is a convex polygon with N vertices. A tree stands outside the wall at the integer coordinates (X,Y), and a knight ties his horse to that tree with a rope of length L.
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 P outside the castle exactly when the shortest path from the tree to P that avoids the interior of the castle has length at most L.
Compute the area of the region the horse reaches.