Programming Language Z has 26 variables. Their names are the lowercase English letters a through z, and every variable is initially 0.
During execution, each variable stores only an integer from 0 to 9999. If a value outside this range is assigned to a variable, the value stored is the remainder after dividing it by 10000.
Each line of the program contains exactly one command, and every command is one of the following five forms.
| Command | Meaning |
|---|---|
BEGIN | Appears only on the first line of the program. |
var = expr | Stores the value of expression expr in the variable var on the left. The expression consists of one or more terms joined by + or -. Each term is either a constant or a variable. If a constant is written immediately before a variable, multiply that variable by the constant. For example, a = 2b + 4 - c stores 2 * b + 4 - c in a. Every operator has a space before and after it. Each constant is an integer from 0 to 999. |
REPEAT n | Starts a block and repeats that block n times. (1 <= n <= 100000) |
STOP | Ends the current block. |
PRINT var | Prints the current value of variable var in the form var = value. |
Given a program written in Programming Language Z, determine exactly what it prints while running.
The input is a program written in Programming Language Z. The program has at most 50 lines, and each line contains one command. Each line is at most 100 characters long. BEGIN...STOP and REPEAT...STOP blocks are indented by 3 spaces for each increase in nesting depth. During execution, PRINT commands are executed at most 20 times.
Whenever a PRINT command is encountered while executing the program, output its result on one line.