Under construction

Still being built. Things may change

Roads in a City

Time limit8sMemory limit512 MB

Summary
Given road segments with capacities, compute the area inside the square from -5 to 5 that lies within distance r of at least one segment.
Level

Medium7 of 10

Topics
Geometry, Implementation
Solved
No attempts yet

Problem

Roads in a city play an important role in its development. Once a road is built, people start living around it. A broader road has a larger capacity, so people can live in a wider area around it.

The Interstellar Conglomerate of Plantation and Colonization (ICPC) plans to build roads on a new territory. The territory is a square and is completely clear. ICPC has several plans but finds it hard to judge which one is best.

So ICPC asked several programmers, including you, to write programs that compute metrics for each plan. Your task is fairly simple: given the locations and capacities of the roads, compute the area where people can live.

Figure 1: The first plan

Input

The input consists of several plans. The first line of each plan gives the number of roads nn (n≤50n \le 50). The next nn lines each contain five integers x1x_1, y1y_1, x2x_2, y2y_2, and rr, separated by spaces. (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) are the endpoints of a road segment (−15≤x1,y1,x2,y2≤15-15 \le x_1, y_1, x_2, y_2 \le 15), and rr is the capacity, the maximum distance from the road at which people can live (r≤10r \le 10).

The input ends with a line containing only 0.

The territory lies in −5≤x,y≤5-5 \le x, y \le 5. Each road is a straight line segment, and no segment degenerates. You may assume this.

Output

For each plan, print the area where people can live on one line. You may print any number of digits after the decimal point, as long as the difference from the exact answer is at most 0.01.

Examples1

  1. Example 1

    Input
    2
    0 -12 0 0 2
    0 0 12 0 2
    0
    
    Expected output
    39.14159