/**
 * Behdad Hosseini, mailto:acm(AT)behdadh(DOT)net(replace AT and DOT), behdadh.net
 * Date: 26 may 2004
 * A sample code for ACM problem : A (Atlantis) from 2000 Europe - MidCenter
 */
#include <fstream.h>

#define MAX 100

double x1[MAX], y1[MAX], x2[MAX], y2[MAX];
double xx[2*MAX], yy[2*MAX]; // sorted x's and y's
int n;

// check whether (x,y) is inside of any of input rectangles?
int isInside( double x, double y )
{
	for (int i =0; i< n; i++)
		if ( (x >= x1[i]) && (x <= x2[i]) && (y >= y1[i]) && (y <= y2[i]) )
			return 1;
	return 0;
}

// sort in1, in2 and store the resulted array in out
void sort( double in1[], double in2[], int size, double out[] ) 
{
	// first store in1 and in2 into out
	for (int i=0;i<size;i++)
	{
		out[i] = in1[i];
		out[i+size] = in2[i];
	}

	// sort (exchange sort)
	for (i=0; i<2*size; i++)
		for (int j=i+1;j<2*size;j++)
			if (out[i] > out[j])
			{
				double temp = out[i];
				out[i] = out[j];
				out[j] = temp;
			}
}


void main()
{
	ifstream in("atlantis.in");
	ofstream out("atlantis.out");

	// set output format
	out.setf(ios::showpoint | ios::fixed);
	out.precision(2);
	
	for(int tc =1;; tc++)
	{
		// begin of the test case
		in >> n;

		if (n == 0) 
			break;

		// read input
		for (int i=0;i <n; i++)
			in >> x1[i] >> y1[i] >> x2[i] >> y2[i];

		// solve
		sort(x1,x2,n,xx);
		sort(y1,y2,n,yy);

		double area = 0;
		for (int j=0; j<2*n -1; j++) // x of the first point
			for (int k =0; k < 2*n -1; k ++) // y of the first point
				if ( isInside((xx[j] + xx[j+1])/2,(yy[k] + yy[k+1])/2) )
					area += (xx[j+1] - xx[j])*(yy[k+1] - yy[k]);

		// write output
		out << "Test case #" << tc << endl;
		out << "Total explored area: " << area << endl << endl;
	}

	out.close();
	in.close();
}


