#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

double dist(double x1, double y1, double x2, double y2)
{
	double dx = x1-x2;
	double dy = y1-y2;
	return sqrt(dx*dx+dy*dy);
}

bool between(double a, double b, double c)
{
	if (b < c)
		return (b<a && a<c);
	else
		return (c<a && a<b);
}

int main()
{
	double x1, y1, x2, y2, wx1, wy1, wx2, wy2;
	double ans;
	for(int icase=1; ; icase++) {
		cin >> x1 >> y1 >> x2 >>y2;
    if(x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0)
      break;
		cin >> wx1 >> wy1 >> wx2 >>wy2;
		if (wx1 == wx2) {
			if (x1 == x2 || !between(wx1, x1, x2))
				ans = dist(x1, y1, x2, y2);
			else {
				double yint = y1 + (y2-y1)*(wx1-x1)/(x2-x1);
				if (between(yint, wy1, wy2)) {
					double dist1 = dist(x1,y1,wx1,wy1)+dist(wx1,wy1,x2,y2);
					double dist2 = dist(x1,y1,wx2,wy2)+dist(wx2,wy2,x2,y2);
					ans = (dist1<dist2) ? dist1 : dist2;
				}
				else
					ans = dist(x1, y1, x2, y2);
			}
		}
		else {
			if (y1 == y2 || !between(wy1, y1, y2))
				ans = dist(x1, y1, x2, y2);
			else {
				double xint = x1 + (x2-x1)*(wy1-y1)/(y2-y1);
				if (between(xint, wx1, wx2)) {
					double dist1 = dist(x1,y1,wx1,wy1)+dist(wx1,wy1,x2,y2);
					double dist2 = dist(x1,y1,wx2,wy2)+dist(wx2,wy2,x2,y2);
					ans = (dist1<dist2) ? dist1 : dist2;
				}
				else
					ans = dist(x1, y1, x2, y2);
			}
		}
    printf("Case %d: %.03f\n", icase, ans/2.0);
	}
}
