The Industrial Computer Processor Company offers very fast, special-purpose processing units tailored to customer needs. Processors of the -C- family (such as -C- and -C-) have an instruction set with only two different operations:
A add
M multiply by
The processor receives an integer, executes a sequence of and operations (the program) that modifies the input, and outputs the result. For example, the -C- processor executing the program with the input yields the output (the computation is 2 \to 3 \to 4 \to 5 \to 10), while the -C- processor yields with the same program and input (2 \to 7 \to 12 \to 17 \to 51).
You are an -C- programmer assigned to a top secret project. This means that you have not been told the precise computation your program should perform. But you are given particular values , , , and and the following conditions:
The input is guaranteed to be a number between and .
The output must be some number between and .
Given an -C- processor and the numbers , , , and , your job is to construct the shortest -C- program which, for every input such that p \leq x \leq q, yields some output such that r \leq y \leq s. If there is more than one program of minimum length, choose the one that comes first lexicographically, treating each program as a string of s and s.
The input contains several test cases. Each test case is given by a line with the six integers , , , , , and (1 \leq a, m, p, q, r, s \leq 10^9, p \leq q, r \leq s).
The last test case is followed by a line with six zeros.
For each test case, display its case number followed by the best program as described above. Display the word empty if the best program uses no operations. Display the word impossible if there is no program meeting the specifications.
Display the program as a sequence of space-separated strings, alternating between strings of the form nA and strings of the form nM, where n > 0. Strings of the former type indicate consecutive operations, and strings of the latter type indicate consecutive operations.
Example 1