// Arup Guha
// 10/19/2016
// Solution to 1997 UCF HS Problem: Psychic Gypsy Test

import java.util.*;

public class gypsy {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int loop = 1;

		// Go through whole input.
		while (stdin.hasNext()) {

			// Annoying input format.
			StringTokenizer tok = new StringTokenizer(stdin.nextLine());
			int n = Integer.parseInt(tok.nextToken());
			ArrayList<Integer> plays = new ArrayList<Integer>();
			while (tok.hasMoreTokens())
				plays.add(Integer.parseInt(tok.nextToken()));

			// Header.
			System.out.print("Game #"+loop+":");

			// Only case she loses.
			if (n == 1)
				System.out.println(" The princess cannot win!");

			// Here play the game.
			else {

				// Find minimum number of turns game could go by maxing out princesses turn.
				int turns = 0, max = 0, prevmax = 0;
				while (max < n) {
					prevmax = max;
					max += (5 + plays.get(turns));
					turns++;
				}

				// Case where we can just play max each time, except for maybe last.
				if (prevmax < n-1) {
					for (int i=0; i<turns-1; i++)
						System.out.print(" P:5 G:"+plays.get(i));

					// We are pretty close, force gypsy to play 1.
					if (prevmax > n-6)
						System.out.println(" P:"+(n-prevmax-1)+" G:1");

					// It's still safe to take 5, so do it.
					else
						System.out.println(" P:5 G:"+(n-prevmax-5));
				}
				else {

					// In this case, we get to n-2 by playiing 4 the first time instead of 5.
					System.out.print(" P:4 G:"+plays.get(0));
					for (int i=1; i<turns-1; i++)
						System.out.print(" P:5 G:"+plays.get(i));

					// Which guarantees that this wins.
					System.out.println(" P:1 G:1");
				}
			}

			loop++;
		}
	}
}