This page is still under construction.

Parts of this page are still being built. What you see may change.

Zeroing Fire

Time limit1sMemory limit512 MB

Summary
Given a center circle of radius R and two distinct shot points, find the area of all positions for a third shot whose circumcenter lies inside the center circle.
Level

Medium7 of 10

Topics
Geometry, Math, Linked list, Implementation
Solved
No attempts yet

Problem

Doju, who has gone to the Nonsan training center, is receiving zeroing fire training. In this training, the soldier fires three shots at a target with a circle drawn at its center, and passes if the circumcenter of the three bullet holes (the center of the circle passing through all three points) lies inside the center circle. A point lying exactly on the circumference is also allowed, and if the three points fail to form a triangle, the soldier fails. It is a hard standard to understand, but training centers have always been like that.

Doju has already fired two shots. Find the area of the region that the remaining shot must hit in order to pass the training.

For convenience, treat the target as a coordinate plane whose origin is the center of the circle, and assume that the bullet never leaves the target because the target is infinite in size.

Input

The first line gives an integer R(1≤R≤500)R(1 \le R \le 500), the radius of the circle drawn at the center of the target, and four integers x1,y1,x2,y2(−500≤x1,y1,x2,y2≤500)x_1, y_1, x_2, y_2(-500 \le x_1, y_1, x_2, y_2 \le 500), the positions of the two bullet holes already fired, separated by spaces. The two points are guaranteed to be distinct.

Output

On the first line, print the area of the region that the third bullet must hit. An answer within an absolute or relative error of 10−410^{-4} or less is accepted.

Hint

Examples of cases that pass and fail the training

These are examples of cases that pass and fail the training in the first sample. The red point is the position of the third bullet hole, and the blue point is the circumcenter of the three points.

Examples2

  1. Example 1

    Input
    1 -1 -1 1 1
    Expected output
    13.04261075353702828801633
  2. Example 2

    Input
    1 2 1 -3 3
    Expected output
    0