Welcome to ZOJ Contests Information Problems Runs Statistics Ranklist Clarification 121 - The 2012 ACM-ICPC Asia Changchun Regional Contest - D
Simple Function

Time Limit: 2 Seconds      Memory Limit: 32768 KB

Description

Knowing that x can be any real number that x2 + Dx + E ≠ 0. Now, given the following function

y = f(x) =
 Ax2 + Bx+ C ------------------- x2 + Dx + E

What is the range of y.

Input

The first line contains a single integer T (T ≤ 10000), indicating that there are T cases below.

Each case contains five integers in a single line which are values of A, B, C, D and E (-100 ≤ A, B, C, D, E ≤ 100).

Output

For each case, output the range of y in the form of standard interval expression like in a single line.

The expression is made up by one interval or union of several disjoint intervals.

Each interval is one of the following four forms: "(a, b)", "(a, b]", "[a, b)", "[a, b]"(there is a single space between ',' and 'b'), where a, b are real numbers rounded to 4 decimal places, or "-INF" or "INF" if the value is negative infinity or positive infinity.

If the expression is made up by several disjoint intervals, put the letter 'U' between adjacent intervals. There should be a single space between 'U' and nearby intervals.

In order to make the expression unique, the expression should contain as minimum of intervals as possible and intervals should be listed in increasing order.

See sample output for more detail.

```5
1 1 1 2 3
0 1 0 1 -10
-3 -1 0 -1 -1
0 0 0 0 0
1 3 0 2 0
```

Sample Output

```[0.3170, 1.1830]
(-INF, INF)
(-INF, -1.8944] U [-0.1056, INF)
[0.0000, 0.0000]
(-INF, 1.0000) U (1.0000, 1.5000) U (1.5000, INF)
```

Submit    Status