Hide

# Problem CCompiler

One thing almost all computers have in common, whether it is a simple stack-based calculator, a 6502 powered BBC Micro, or a brand new Android phone, every modern computer requires programs that turn either high-level languages or assembly language into machine code.

UKIEPC recently designed their own processor. While very easy to load programs onto, it is not as complex as some, since it has only one aim: show a number on an innovative laser display board!

The available memory consists of three $8$-bit registers: A, X, and Y, plus an infinite stack. At program start these registers are initialised to unknown values, and the stack is empty.

The processor supports six unique instructions:

• PH <reg>: push the contents of the register (i.e. A, X, or Y) onto the stack.

• PL <reg>: pop a value off the stack into the register. The program will terminate if this instruction is called when the stack is empty.

• AD: pop two values off the stack, and push the lowest $8$ bits of their sum onto the stack.

• ZE <reg>: set the register equal to zero.

• ST <reg>: set the register equal to one.

• DI <reg>: send the value of the register to the laser display board and exit.

Due to memory constraints, the maximum number of instructions that can be written to disk is $40$. Further instructions will not be executed.

Given a number, write a program to output the number on the laser display board.

## Input

• One line containing an integer $N$ ($0 \le N \le 255$), the number to output.

## Output

• At most $40$ lines, each containing one valid instruction.

When run in sequence the lines should output the number $N$. The last instruction should be a DI.

Sample Input 1 Sample Output 1
2

ST A
ST X
PH A
PH X
PL Y
DI Y

Sample Input 2 Sample Output 2
5

ST X
PH X
PH X
PH X