#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL Long Long
#define DB Double
using namespace Std;
Const DB PI = ACOs (-1.0);
struct cycle{
DB X,y,r;
void Get () {scanf ("%lf%lf%lf", &x,&y,&r);}
};
DB Dist (cycle a,cycle B)
{
return sqrt ((a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (A.Y-B.Y));
}
int main ()
{
#ifndef Online_judge
Freopen ("In.txt", "R", stdin);
Freopen ("OUT.txt", "R", stdout);
#endif
Cycle a,c,b;
int cas,t=1;scanf ("%d", &cas);
while (cas--)
{
A.get (); B.get (); C.get ();
if (A.Y-A.R>B.Y-B.R) swap (A, b);
DB d = Dist (A, b);
DB Alph = Atan ((b.y-a.y)/fabs (b.x-a.x))-asin ((B.R-A.R)/d);
DB low = A.y-a.r/cos (Alph);
DB D1 = c.y-low-fabs (c.x-a.x) *tan (Alph)-c.r/cos (Alph);
DB D2;
if (Fabs (A.Y-A.R-B.Y+B.R) <0.1)
{
D2 = 0;
}else
{
DB L1 = sqrt ((A.R+C.R) * (A.R+C.R)-(A.R-C.R) * (A.R-C.R));
D2 = Fabs (a.x-c.x)/cos (Alph) +c.r*tan (Alph)-a.r*tan (Alph)-L1;
D2 = D2/C.R/2/PI;
}
printf ("Case%d:%.10lf\n", T++,D1+D2);
}
return 0;
}
1378 The Falling Circle