#include
#include <string.h>
#include
#define N 110
int n;
double xl[N],yl[N];
double xr[N],yu[N];
double x[2*N],y[2*N];
int xcnt,ycnt;
bool flag[2*N][2*N];
int cmp(const void *a,const void *b)
{
return *(double*)a>*(double*)b?1:-1;
}
void init()
{
xcnt=ycnt=0;
memset(flag,0,sizeof(flag));
}
void read()
{
double a,b,c,d;
for(int i=0;i)
{
scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
xl[i]=a; yl[i]=b;
xr[i]=c; yu[i]=d;
x[xcnt++]=a; x[xcnt++]=c;
y[ycnt++]=b; y[ycnt++]=d;
}
}
int bsx(double k)
{
int min=0,max=xcnt,mid;
while(min+1!=max)
{
mid=min+max>>1;
if(x[mid]>k) max=mid;
else min=mid;
}
return min;
}
int bsy(double k)
{
int min=0,max=ycnt,mid;
while(min+1!=max)
{
mid=min+max>>1;
if(y[mid]>k) max=mid;
else min=mid;
}
return min;
}
void solve()
{
int i,j,k;
qsort(x,xcnt,sizeof(x[0]),cmp);
qsort(y,ycnt,sizeof(y[0]),cmp);
k=xcnt;
xcnt=0;
x[xcnt++]=x[0];
for(i=1;iif(x[xcnt-1]!=x[i]) x[xcnt++]=x[i];
k=ycnt;
ycnt=0;
y[ycnt++]=y[0];
for(i=1;iif(y[ycnt-1]!=y[i]) y[ycnt++]=y[i];
int a,b,c,d;
for(k=0;k)
{
a=bsx(xl[k]); b=bsy(yl[k]);
c=bsx(xr[k]); d=bsy(yu[k]);
for(i=a;i)
{
for(j=b;jtrue;
}
}
double ans=0;
for(i=0;i1;i++)
{
for(j=0;j1;j++) if(flag[i][j]) ans+=(x[i+1]-x[i])*(y[j+1]-y[j]);
}
printf("Total explored area: %.2lf\n\n",ans);
}
int main()
{
int kase=0;
while(scanf("%d",&n),n)
{
init();
read();
printf("Test case #%d\n",++kase);
solve();
}
return 0;
}