MAXLN - THE MAX LINES

In this problem you will be given a half-circle. The half-circle’s radius is r. You can take any point A on the half-circle and draw 2 lines from the point to the two sides of the diameter(AB and AC). Let the sum of square of one line’s length and the other line’s length is s

Like in the figure s = AB2 + AC. And BC = 2r.

Now given r you have to find the maximum value of s. That is you have to find point A such that AB2 + AC is maximum.

Input

First line of the test case will be the number of test case T (1 ≤ T ≤ 1000). Then T lines follows. On each line you will find a integer number r (1 ≤ r ≤ 1000000); each representing the radius of the half-circle.

Output

For each input line, print a line containing "Case I: ", where I is the test case number and the maximum value of s. Print 2 digit after decimal (Errors should be less then .01).

Example

Sample Input:
1
1

Sample Output:
Case 1: 4.25

Added by:Muhammad Ridowan
Date:2011-03-28
Time limit:1s-1.679s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem(used for CSE,University of Dhaka, Newbies Contest)

hide comments
2013-06-27 14:12:13 UTKARSH
ppl remember \n it costed me two wa's.
2013-06-14 00:34:36 Rana Saha
No need of float and double .. No tricks.. Simple differentiation..
2013-06-14 00:27:22 Rana Saha
Forgot to print Case....and got 2 WA :) .. Move it to tutorials ..
2013-05-08 16:54:32 shashank
my 26 question AC. and this was done in first attemt , you just have to know differentiation and then this will be easy one.
2013-04-06 09:27:26 ওয়াসী (Wasi)
I just solved it only using integers!!! and a little trick not even used any float variable.
2013-03-29 02:41:23 Juɑƞ Chɑpɑrro
Easy!
2013-02-03 09:18:27 Rohan Joshi
move to tutorial pls...more emphasis on formatting output...
2013-01-25 20:36:10 rishabhshinghal
should be moved to tutorial
2012-12-10 07:53:28 #vaidy_MIT#
ANd it is my 50 th problem :) learnt a lot from spoj :) Love you so much :)
2012-11-21 05:51:31 sunny
getting tle for%Lf.plz explain
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.