// Arup Guha
// Started in November.
// Finished on 5/20/2012
// Solution to 2011 South East Regional Problem I: Moving Points.

// We basically do an optimized brute force search of tracking down the points in
// all different orders and report the fastest time we can catch them.

// For each subset of points and ending point, we calculate the fastest time we can
// chase down those subset of points, ending at the specified last point. Thus, we have
// to store answers to 15 * 2^15 different sub-problems.

/*** Adapted on 1/31/2013 to solve 2011 Rocky Mountain Regional Problem J: Supply Mission ***/

import java.util.*;

// Stores a basic Cartesian point.
class point {

	public double x;
	public double y;

	public point (double myx, double myy) {
		x = myx;
		y = myy;
	}

	public double distance(point other) {
		return Math.sqrt(Math.pow(other.x-x,2) + Math.pow(other.y-y,2));
	}

	public String toString() {
		return "("+x+", "+y+")";
	}

	public boolean equals(point other) {
		return this.distance(other) < 1e-10;
	}
}

class target {

	public point location;
	public double speed;
	public double radians;

	public target(int myx, int myy, int dx, int dy) {
		location = new point(myx, myy);
		speed = Math.sqrt(dx*dx+dy*dy);
		radians = Math.atan2(dy,dx);
	}

	public point atTime(double t) {

		double x = location.x + Math.cos(radians)*t*speed;
		double y = location.y + Math.sin(radians)*t*speed;
		return new point(x,y);
	}

	// Returns the time it takes for the cop at startLoc to catch this target, if
	// the cop starts at starttime going chaseSpeed.
	public double catchPoint(point startLoc, double starttime, int chaseSpeed) {

		// My goal is to figure out when next and startLoc will meet.
		point next = atTime(starttime);

		// We're here already!
		if (next.equals(startLoc)) return starttime;

		// Here we set up an equation based on the x,y coordinates of both points in
		// terms of time. These two points should be equal at the appropriate value of t.
		// (x1 + t*speed*cos(rad), y1 + t*speed*sin(rad)) and
		// (startx + t*chase*cos(phi), starty + t*chase*sin(phi))

		// These are handy to have.
		double diffx = next.x - startLoc.x;
		double diffy = next.y - startLoc.y;

		// This is the RHS of the main equation to solve for phi.
		double RHS = - diffy*speed*Math.cos(radians) + diffx*speed*Math.sin(radians);

		// The left-hand side is initially Asin(phi) + Bsin(phi), using the A and B
		// below. We convert this to Rsin(phi + shift), so it's a simple trig function.
		double A = diffx*chaseSpeed;
		double B = -diffy*chaseSpeed;
		double R = Math.sqrt(A*A + B*B);
		double shiftangle = Math.atan2(B, A);

		// Now, we have Rsin(phi + shift) = RHS, so divide by R, take the
		// inverse sin and subtract out shift. There are two possible answers,
		// so if angle1 is one of them, its supplement is the other.
		double angle1 = Math.asin(RHS/R) - shiftangle;
		double angle2 = Math.PI -  Math.asin(RHS/R) + shiftangle;

		// Now, we need to check to see if which one is the right answer.
		double t1 = 0, t2 = 0;

		// When we plug back in for t, we need this difference of x's to exist.
		if (Math.abs(startLoc.x - next.x) > 1e-9) {
			t1 = (startLoc.x - next.x)/(speed*Math.cos(radians)-chaseSpeed*Math.cos(angle1));
			t2 = (startLoc.x - next.x)/(speed*Math.cos(radians)-chaseSpeed*Math.cos(angle2));
		}

		// If the x's are equal, we know the y's aren't and the other equation is safe to use.
		else {
			t1 = (startLoc.y - next.y)/(speed*Math.sin(radians)-chaseSpeed*Math.sin(angle1));
			t2 = (startLoc.y - next.y)/(speed*Math.sin(radians)-chaseSpeed*Math.sin(angle2));
		}

		// t must be positive...
		double t = t1;
		if (t < 0)
			t = t2;

		// This is our convention, to return the total time elapsed, so add t to starttime.
		return t + starttime;
	}

}

public class j {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int n = stdin.nextInt();
		int caseNum = 1;

		while (n != 0) {

			target[] badguys = new target[n+1];
			for (int i=0; i<n; i++) {
				int x = stdin.nextInt();
				int y = stdin.nextInt();
				int dx = stdin.nextInt();
				int dy = stdin.nextInt();
				badguys[i] = new target(x, y, dx, dy);
			}

			int heliX = stdin.nextInt();
			int heliY = stdin.nextInt();

			// Make this the last point in the bunch!
			badguys[n] = new target(heliX, heliY, 0, 0);

			int chaseSpeed = stdin.nextInt();

			// Will store all the best times...
			double[][] besttimes = new double[1 << (n+1)][n+1];

			// No values stored.
			for (int i=0; i<besttimes.length; i++)
				for (int j=0; j<besttimes[i].length; j++)
					besttimes[i][j] = -1;

			// Just get to this one point by itself. No need to go to itself. This is already 0...
			for (int i=0; i<n; i++)
				besttimes[1 << i][i] = badguys[i].catchPoint(new point(heliX,heliY), 0, chaseSpeed) + 1;

			// Solve and go to next case.
			double best = solve((1 << (n+1)) - 1, n, besttimes, chaseSpeed, badguys);
			printTime(best, caseNum);
			n = stdin.nextInt();
			caseNum++;
		}

	}

	/*** For Rocky Mountain Version - needs hours, minutes seconds... ***/
	public static void printTime(double hrs, int caseNum) {

		// Round up to the next second.
		hrs += 1.0/3600;

		// Parse out components and print.
		int b = (int)hrs;
		double min = 60*(hrs - b);
		int c = (int)min;
		int d = (int)(60*(min - c));
		System.out.println("Case "+caseNum+": "+b+" hour(s) "+c+" minute(s) "+d+" second(s)");
	}

	// set stores which set we are solving for (it's a bitmask), last stores the last point to visit,
	// table is our storage of best times, chaseSpeed is the cop's chase speed and T stores all the
	// target information.
	public static double solve(int set, int last, double[][] table, int chaseSpeed, target[] T) {

		if (set == 0)
			return 0;

		// We know this answer already...so return it.
		if (table[set][last] != -1)
			return table[set][last];

		int saveset = set;
		double best = 1000000000;

		int without = saveset - (1 << last);
		int savewithout = without;

		// Try for each best set without the last item, then add the time from
		// that set to the last item.
		int item = 0;
		while (without > 0) {

			// This item is in our set.
			if ((without & 1) == 1) {

				// Solve this sub-problem since we haven't before.
				/*** Add one hour for unloading supplies, for Rocky Mountain Problem ***/
				if (table[savewithout][item] == -1)
					table[savewithout][item] = solve(savewithout, item, table, chaseSpeed, T) + 1;

				// Calculate the time to get from that item to last.
				point pointbefore = T[item].atTime(table[savewithout][item]);
				double newtime = T[last].catchPoint(pointbefore, table[savewithout][item], chaseSpeed);

				// If it's better, update!
				if (newtime < best)
					best = newtime;
			}

			// Go to the next potential item.
			without = without >> 1;
			item++;

		} // end without

		// Store our answer before returning.
		table[set][last] = best;
		return best;
	}

}