//* Problem  : F: Square Count
//* Contest  : ECNA-2005
//* Type     : Solution
//* Date     : 2008.08.04
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

typedef pair <int,int> PIII;
typedef vector <int> VI;
typedef vector <vector<int> > VVI;
typedef vector <pair<int,int> > VPII;
typedef vector <vector<pair<int,int> > > VVPII;

#define int64 long long
#define PI (2.0 * acos(0.0))
#define MP make_pair
#define PB push_back
#define SZ(a) (int)a.size()
#define FOR(i, n) for (int i = 0; i < (int)n; i++)
#define FORSZ(i, a) FOR(i, SZ(a))
#define FORE(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(a); i >= int(b); i--)
#define INF 1000000000
#define INFL 1000000000000000000LL
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()

inline int si(){int tt; scanf("%d", &tt); return tt;}

struct rect{
	int x1, y1, x2, y2;
}a[1024];

int n;

int64 res;

int64 count(int n, int m)
{
	if (m > n)swap(n, m);
	if (m <= 0) return 0;
	return m * (int64)(3*m*n+3*n+1-m*m)/6;
}

int64 count2(int x, int y1, int y2)
{
	int64 res = 0;
	res += count(x, y1 + y2);
	res -= count(x, y1);
	res -= count(x, y2);
	return res;
}

int overlap(int l1, int r1, int l2, int r2)
{
	if (r1 <= l2) return 0;
	if (r2 <= l1) return 0;
	int l = max(l1, l2);
	int r = min(r1, r2);
	return r - l;
}

void solve()
{
//	printf("%lld\n", count(2, 4)); return;
	res = 0;
	FOR(i, n)
		res += count(a[i].x2 - a[i].x1, a[i].y2 - a[i].y1);
	FOR(i, n) FOR(j, n)
	{
		if (a[i].x1 == a[j].x2)
		{
			int len = overlap(a[i].y1, a[i].y2, a[j].y1, a[j].y2);
			if (len > 2)
				res += count2(len-2, a[i].x2 - a[i].x1, a[j].x2 - a[j].x1);
		}
		if (a[i].y1 == a[j].y2)
		{
			int len = overlap(a[i].x1, a[i].x2, a[j].x1, a[j].x2);
			if (len > 2)
				res += count2(len-2, a[i].y2 - a[i].y1, a[j].y2 - a[j].y1);
		}
	}
}

int main()
{
#ifdef _DEBUG
	freopen("1064", "r", stdin);
//	freopen("1064w", "w", stdout);
#endif
	int it = 0;
	while (scanf("%d", &n) == 1 && n)
	{
		FOR(i,n)
		{
			int x1 = si(), y1 = si(), x2 = si(), y2 = si();
			a[i].x1 = min(x1, x2);
			a[i].y1 = min(y1, y2);
			a[i].x2 = max(x1, x2);
			a[i].y2 = max(y1, y2);
		}
		solve();
		printf("Case %d: %lld\n", ++it, res);
	}
	return 0;
}

