#include<cmath>
#include<queue>
#include<cstdio>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const double EPS=1e-6;
const double INF=1e77;
const double PI=acos(-1);

struct point{
	double x,y;
	point():x(0),y(0){}
	point(double x,double y):x(x),y(y){}
	point &operator/=(double c){ x/=c; y/=c; return *this; }
	point operator+(const point &a)const{ return point(x+a.x,y+a.y); }
	point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
	bool operator< (const point &a)const{ return x+EPS<a.x || abs(x-a.x)<EPS && y+EPS<a.y; }
	bool operator==(const point &a)const{ return abs(x-a.x)<EPS && abs(y-a.y)<EPS; }
};

point operator*(double c,const point &a){ return point(c*a.x,c*a.y); }

double dot(const point &a,const point &b){ return a.x*b.x+a.y*b.y; }

double cross(const point &a,const point &b){ return a.x*b.y-a.y*b.x; }

double abs(const point &a){ return sqrt(a.x*a.x+a.y*a.y); }

double abs2(const point &a){ return a.x*a.x+a.y*a.y; }

point rot(const point &a,double theta){ return point(a.x*cos(theta)-a.y*sin(theta),a.x*sin(theta)+a.y*cos(theta)); }

struct line{
	point a,b;
	line(){}
	line(const point &a,const point &b):a(a),b(b){}
};

struct segment{
	point a,b;
	segment(){}
	segment(const point &a,const point &b):a(a),b(b){}
	operator line()const{ return line(a,b); }
};

point proj(const line &L,const point &p){ return L.a+dot(p-L.a,L.b-L.a)/abs2(L.b-L.a)*(L.b-L.a); }

enum{CCW=1,CW=-1,ON=0};
int ccw(const point &a,const point &b,const point &c){
	double rdir=cross(b-a,c-a);
	if(rdir> EPS) return CCW;
	if(rdir<-EPS) return CW;
	return ON;
}

bool cover(const segment &S,const point &p){
	return abs(cross(S.a-p,S.b-p))<EPS && dot(S.a-p,S.b-p)<EPS;
}

bool intersect(const segment &S1,const segment &S2){
	if(max(S1.a.x,S1.b.x)+EPS<min(S2.a.x,S2.b.x)
	|| max(S1.a.y,S1.b.y)+EPS<min(S2.a.y,S2.b.y)
	|| max(S2.a.x,S2.b.x)+EPS<min(S1.a.x,S1.b.x)
	|| max(S2.a.y,S2.b.y)+EPS<min(S1.a.y,S1.b.y)) return false;
	return ccw(S1.a,S1.b,S2.a)*ccw(S1.a,S1.b,S2.b)<=0
		&& ccw(S2.a,S2.b,S1.a)*ccw(S2.a,S2.b,S1.b)<=0;
}

point get_intersect(const segment &S1,const segment &S2){
	double a1=cross(S1.b-S1.a,S2.b-S2.a);
	double a2=cross(S1.b-S1.a,S1.b-S2.a);
	if(abs(a1)<EPS){
		if(cover(S1,S2.a)) return S2.a;
		if(cover(S1,S2.b)) return S2.b;
		if(cover(S2,S1.a)) return S1.a;
		return S1.b;
	}
	return S2.a+a2/a1*(S2.b-S2.a);
}

void arrangement(const vector<segment> &S,vector<point> &P,vector<int> *G,point s,point g){
	int n=S.size();
	P.clear();
	P.push_back(s); // 特別に追加する
	P.push_back(g); // 特別に追加する
	rep(i,n){
		P.push_back(S[i].a);
		P.push_back(S[i].b);
		rep(j,i) if(intersect(S[i],S[j])) P.push_back(get_intersect(S[i],S[j]));
	}
	sort(P.begin(),P.end());
	P.erase(unique(P.begin(),P.end()),P.end());

	rep(u,P.size()) G[u].clear();
	rep(i,n){
		vector<int> on;
		rep(u,P.size()) if(cover(S[i],P[u])) on.push_back(u);
		rep(j,(int)on.size()-1){
			int u=on[j],v=on[j+1];
			G[u].push_back(v);
			G[v].push_back(u);
		}
	}
}

int main(){
	for(int cas=1,n;scanf("%d",&n),n;cas++){
		point s,g; scanf("%lf%lf%lf%lf",&s.x,&s.y,&g.x,&g.y);
		segment F[100];
		rep(i,n) scanf("%lf%lf%lf%lf",&F[i].a.x,&F[i].a.y,&F[i].b.x,&F[i].b.y);

		vector<segment> S;
		rep(i,n){
			point v=rot(F[i].b-F[i].a,PI/2); v/=abs(v);
			// start-electrode, goal-electrode
			if(cover(F[i],proj(F[i],s))) S.push_back(segment(s-1e4*v,s+1e4*v));
			if(cover(F[i],proj(F[i],g))) S.push_back(segment(g-1e4*v,g+1e4*v));
			// electrode rail
			S.push_back(segment(F[i].a-1e4*v,F[i].a+1e4*v));
			S.push_back(segment(F[i].b-1e4*v,F[i].b+1e4*v));
		}

		vector<point> P;
		static vector<int> G[30000];
		arrangement(S,P,G,s,g);

		int s_id=-1,g_id=-1;
		rep(u,P.size()){
			if(P[u]==s) s_id=u;
			if(P[u]==g) g_id=u;
		}

		// Dijkstra
		vector<double> d(P.size(),INF);
		d[s_id]=0;
		priority_queue< pair<double,int> > Q; Q.push(make_pair(0,s_id));
		while(!Q.empty()){
			double d_now=-Q.top().first;
			int u=Q.top().second; Q.pop();

			if(d[u]<d_now-EPS) continue;

			rep(i,G[u].size()){
				int v=G[u][i];
				double d_next=d[u]+abs(P[u]-P[v]);
				if(d_next+EPS<d[v]){
					d[v]=d_next;
					Q.push(make_pair(-d[v],v));
				}
			}
		}

		printf("Case %d: ",cas);
		if(d[g_id]<INF/2) printf("%.5f\n",d[g_id]); else puts("Impossible");
	}

	return 0;
}

Measured memory_bytes: 3304