387. Lazy Judges

Time limit per test: 1.5 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

It's no secret that in order to build a baseball stadium one needs to create a project first. The chief engineer in the town NN is preparing such a project now and he has met some difficulties. There is only one brigade of baseball judges in NN, and they are very lazy, so they have some restrictions for the project. As you know, a baseball field has a form of square with bases in its corners. There is one chief judge in the brigade and he wants the center of the baseball field to be located at a fixed point (0,0) (he will stay at this point and see all the course of the game). All the other n judges will also stay at some predefined points. Each of them will see only one segment with ends in the points with coordinates (xi1,yi1) and (xi2,yi2). It is also important that every base should belong to at least one of these segments. If there are several ways to build the baseball field, the chief engineer acts in the following way. He considers the set of all possible positions of the first base and chooses one of them randomly with a uniform distribution.

Your task is to calculate the expected area of the field.

The first line of the input file contains an integer number n, 1 ≤ n ≤ 50. Each of the following n lines contains four integer numbers xi1, yi1, xi2, yi2 — coordinates of ends of the i-th segment. All coordinates do not exceed 100 by absolute value. It is guaranteed that there is at least one way to build the baseball field. All segments are non-degenerate. They may intersect, but it is guaranteed that they do not overlap.

Output should contain one real number — the expected area of the field with relative or absolute error 10-9.

sample input
sample output
-3 -1 3 -1
-3 -1 0 2
3 -1 0 2

Online Contester Team © 2002 - 2010. All rights reserved.