ROOTCIPH - Decipher


Radar scanned the approaching enemy aircraft on the border. However due to some error part of the tranmitted data can't be deciphered. It was possible only to obtain the coefficients of the cubic polynomial, whose roots are the coordinates of the aircraft relative to the radar. Now you need to calculate the distance to the aircraft. Write the program to solve this task.

Input

The first line contains T (1 <= T <= 1000) - number tests. The next T lines contain three integers a, b and c - coefficients of the polynomial x3 + ax2 + bx + c, whose roots are the coordinates (the absolute value of the coordinates do not exceed 108).

Output

For each test print the square of the distance to the enemy aircraft.

Example

Input:
1
-6 11 -6

Output:
14

hide comments
starbot: 2017-03-13 15:46:41

too easy...basic maths...WA with cin/cout,AC with scanf/printf
#SPOJ_is_drunk....

nilabja16180: 2017-03-10 09:43:32

WA using cin,cout, AC using scanf, printf! :/ curious!

cake_is_a_lie: 2017-02-21 14:28:23

This is amazingly weird, but as somebody before stated, I got WA using cin/cout and AC using scanf/printf. The solution is amazingly simple and only uses integer arithmetic, so no idea why.

cs_abhi2000: 2016-12-18 14:28:17

@Shubham , yes u are right. How distance be negative...
It is showing WA when we are using abs function in c.

shubham_cs_iet: 2016-12-18 13:32:56

taking absolute value of distance gives me WA in c. Bug in the question, how distance can be negative...

Last edit: 2016-12-18 15:00:03
rmaurya: 2016-10-06 19:52:52

JAVA gives NZEC..
After applying try-catch it gives wrong answer..WHY???

Ashok: 2016-09-19 09:02:53

Java NZEC ??

subhasmita sahoo: 2016-08-19 18:40:30

Same solution in c++ on using cin, cout got WA, but on using printf, scanf got AC!!

Bala Vignesh [Inactive]: 2015-03-16 18:45:39

intimidating question, but not as spooky as it looks! :D

Spooky: 2014-12-16 22:49:58

@xiaowuc1
You are checking the values of a, b and c. There are no explicit constraints on them. 10^8 is the constraint on the coordinates of the aircraft, not the coefficients.


Added by:Spooky
Date:2010-03-09
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 SQLITE VB.NET
Resource:Advancement Spring 2010, http://sevolymp.uuuq.com/, author: Alexey Shchepin