// Arup Guha
// 6/5/2014
// Solution to 2008 UCF High School Programming Contest Problem: Double Double: Scoops with Trouble

import java.util.*;
import java.io.*;

public class scoop {

	public static void main(String[] args) throws IOException {

		Scanner fin = new Scanner(new File("scoop.in"));
		int numCases = fin.nextInt();

		// Process each case
		for (int loop=1; loop<=numCases; loop++) {

			String word = fin.next();
			int ans = 1;

			// Keep on reading until we get to scoop.
			while (!word.equals("Scoop")) {

				// Multiply in the correct factor.
				if (word.equals("Double")) ans *= 2;
				else if (word.equals("Triple")) ans *= 3;
				else if (word.equals("Quadruple")) ans *= 4;

				// Get next word.
				word = fin.next();
			}

			// Print result.
			System.out.println("Order #"+loop+": "+ans);
		}

		fin.close();
	}
}