#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;
}