// Arup Guha
// 2/2/2014
// Solution to 2014 UCF HS Online Contest Problem: LTE (ha ha...)

import java.util.*;

public class rounding {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {
			String s = stdin.next();
			System.out.println("Homework #"+loop+": "+solve(s));
		}
	}

	public static int solve(String s) {

		// Find the dot.
		int spot = s.indexOf('.');
		if (spot < 0) return 0;
		s = s.substring(spot+1);

		// Easy case, no 4 in first spot.
		if (s.charAt(0) != '4') return 0;

		// Find first non-4, and return based on that.
		int i = 0;
		while (i < s.length() && s.charAt(i) == '4') i++;

		//Watch out for all 4 case...
		if (i >= s.length() || s.charAt(i) < '5') return 0;
		return 1;
	}
}