/*
 * Lisa Soros
 * BHCSI 2010
 * Programming Contest problem using Math class methods
 */

import java.util.*;
import java.io.*;

public class pebbles
{
	public static void main(String[] args) throws FileNotFoundException
	{
		int numCases, numPoints, curX, curY, nextX, nextY, distance, totalDistance, pebbles;
		
		// Initialize the file scanner
		Scanner fileScanner = new Scanner(new File("pebbles.in"));
		numCases = fileScanner.nextInt();
		
		// For each test case
		for(int i=0; i<numCases; i++)
		{
			numPoints = fileScanner.nextInt();
			distance = 0;
			totalDistance=0;
			pebbles = 1;
			
			curX=fileScanner.nextInt();
			curY=fileScanner.nextInt();

			
			// For each subpath
			for(int j=1; j<numPoints; j++)
			{
				// Get the coordinates of the next destination
				nextX = fileScanner.nextInt();
				nextY = fileScanner.nextInt();
				
				// Calculate the distance traversed
				double actualdistance = Math.sqrt(Math.pow(curX-nextX, 2)+Math.pow(curY-nextY,2));
				distance = (int)Math.ceil(Math.sqrt(Math.pow(curX-nextX, 2)+Math.pow(curY-nextY,2)));
				
				/* Used to screen the input that was generated
				if (distance - actualdistance < .01 && distance - actualdistance > 1e-9)
					System.out.println("Error in input. Case "+(i+1)+" Point "+(j+1));
				*/
					
				totalDistance += distance;
				curX = nextX;
				curY = nextY;
				
				// Calculate the number of pebbles needed
				pebbles += ((distance-1)/10) + 1;
			}
			
			// Output to screen
			System.out.println("Case "+ (i+1)+ ": Hansel and Gretel take "+ totalDistance+ " steps and use "+ pebbles+ " pebbles.");
		}
	}
}
