GEOPROB - One Geometry Problem

This is a problem of Euclidean Geometry. See the figure below.

Your task is as follows: given the lengths of segments b, c, and d, calculate the length of segment a.

Input

The input begins with the number t of test cases in a single line (t<=300). In each of the next t lines there are three integers b, c and d (0 <= b, c and d <= 10200 ; b,d < c) separated by a space.

Output

For every test case print the length of the segment a, one number per line.

Example

Input:
2
3 8 5
10 18 12

Output:
8
14

Added by:Frank Rafael Arteaga
Date:2008-07-30
Time limit:1s
Source limit:4000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE
Resource:My own Resource

hide comments
2011-08-12 00:12:39 Piotr KÄ…kol
@Muwardi Raharjo - bcmath from PHP gives AC. ;-)
2010-12-27 06:09:31 Muwardi Raharjo
i use BigInteger in java, but this is time limit, if use C++ wrong answer...
2010-05-18 15:17:25 sudipto das
c can't be 0
as c>b,d
am i right????????????
2010-04-24 02:55:11 ~!(*(@*!@^&
where is java?
2010-02-17 14:44:12 Devil D
very very simple calculation ... but the range :D
2009-11-13 23:26:32 Richard Cocks
Ah I shouldn't have believed the title! Solved the geometry before reading how big b,c,d would get!
2009-09-20 13:49:01 Abhishek Sinha
I have found that product of two divided portions of a is constant ... but that doesn't completely specify a
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.