Archery

No attempts yetTime limit1sMemory limit128 MB

Problem

Gangsan took up archery as a hobby after watching the 2012 London Olympics. Archery turned out to be harder than he expected. His aim never improved much, so he wrote the rules for a far easier version of the sport.

  • The player stands at the origin and shoots one arrow. The arrow has unlimited penetration and flies forever in the direction it was fired.
  • The firing direction is picked uniformly over all directions, so the angle of the arrow follows the uniform distribution on [0,2π)[0, 2\pi).
  • Each target is a line segment in the plane, and several of them are laid out around the player. Targets may cross or overlap each other. No target passes through the origin, so the player never stands on a target.
  • The arrow pierces every target that meets the ray going out from the origin. An arrow that merely grazes an endpoint of a target counts as piercing it.

Consider a game with two targets. Some directions pierce both targets with one shot, others pierce only one target, and others hit nothing at all. Gangsan found it more fun to work out how many targets one arrow would hit than to shoot the bow himself.

Given the two endpoints of each target, compute the expected number of targets that one arrow pierces.

Input

The first line contains the number of test cases TT. (1T1001 \le T \le 100)

The first line of each test case contains the number of targets NN. (1N1001 \le N \le 100)

Each of the next NN lines contains the integers X1X_1, Y1Y_1, X2X_2, Y2Y_2 separated by spaces. That target is the segment running from (X1,Y1)(X_1, Y_1) to (X2,Y2)(X_2, Y_2). (100X1,Y1,X2,Y2100-100 \le X_1, Y_1, X_2, Y_2 \le 100)

Output

For each test case, print on one line the expected number of targets that one arrow pierces. Round at the sixth decimal place and write five decimal places. The judge data contains no value whose rounding is ambiguous.