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

hide comments
Piotr KÄ…kol: 2011-08-12 00:12:39

@Muwardi Raharjo - bcmath from PHP gives AC. ;-)

Muwardi Raharjo: 2010-12-27 06:09:31

i use BigInteger in java, but this is time limit, if use C++ wrong answer...

sudipto das: 2010-05-18 15:17:25

c can't be 0
as c>b,d
am i right????????????

~!(*(@*!@^&: 2010-04-24 02:55:11

where is java?

Devil D: 2010-02-17 14:44:12

very very simple calculation ... but the range :D

Richard Cocks: 2009-11-13 23:26:32

Ah I shouldn't have believed the title! Solved the geometry before reading how big b,c,d would get!

Abhishek Sinha: 2009-09-20 13:49:01

I have found that product of two divided portions of a is constant ... but that doesn't completely specify a


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