Surveyor Jiyoon

Time limit1sMemory limit128 MB

Summary
Given three lines in ax+by+c=0 form, compute the area of the triangle they form, or 0 if they do not form one.
Level

Medium4 of 10

Topics
Geometry, Math, Implementation
Solved
No attempts yet

Problem

Jiyoon drew three lines and wants to know the area of the triangle formed by them. Each line is given in the form ax + by + c = 0, where a, b, and c are integers. If the three lines form one triangle, output its area. If they do not form a triangle, output 0.

Input

The first line contains the number of test cases T. For each test case, three lines follow. Each of those lines contains integers a, b, and c, representing a line ax + by + c = 0. -1,000 <= a, b, c <= 1,000

Output

For each test case, print one line containing the area of the triangle formed by the three lines, rounded to four digits after the decimal point. If a triangle cannot be formed, print 0.0000.

Examples1

  1. Example 1

    Input
    2
    -2 -4 5
    2 0 0
    0 -4 -1
    1 1 0
    0 1 0
    1 0 0
    
    Expected output
    2.2500
    0.0000