One day, Mrs. Ma tells her whole class that there will be a very hard quadratic equations assignment given to the entire class to finish as an in-class assignment tomorrow. The whole class is freaking out but Larry is the most scared since he SUCKS at solving quadratics.
Luckily, Mrs. Ma has given the details of the assignment. She will give a list of quadratic equations in the form of with one coefficient (, , ) unknown and its two roots. Then the students will be asked to solve for the unknown coefficient.
Write a program that can solve the quadratics given and save Larry from failing the assignment!
Input Specification
The first line will contain the integer .
The next lines will contain the quadratic in the form of and its two roots .
If the quadratic has a double root, it is printed twice.
If , , or , then the is not shown. See sample input 1 for an example.
Output Specification
Output the missing coefficient.
Sample Input 1
1
x^2+bx+1=0 1 1
Sample Output 1
-2
Sample Input 2
4
ax^2-12x+35=0 5 7
2x^2+6x+c=0 -2 -1
x^2+bx+6=0 -6 -1
3x^2+bx+69=0 1 23
Sample Output 2
1
4
7
-72
Comments
Implement Wolfram|Alpha
Literally just use eval xD