E - Xela

Time limit: 2 s
Memory limit: 1024 MiB
Languages: C, C++, Java, Python, ... (details)

Xela is a new programming language designed to compute algebraic operations with nested loops extremely fast. Your task is to build its interpreter.



Language specifications:

  • There are $26$ variables in Xela, one for each lower case English character from a to z. Initially, all variables start at $0$.
  • All algebraic operations are taken modulus prime $998244353$.
  • All scalars in the code are in the range $[0, 998244353)$.
  • Assignment: Instruction that assigns to a variable a scalar or the value of another variable. Example: $\texttt{a = 42}$ (Assigns value $42$ to $a$) or $\texttt{z = x}$ (Assigns current value of $x$ to $z$).
  • Addition: Instruction that adds to any variable a scalar or the value of another variable. Example $\texttt{a += 31415}$ (Adds value $31415$ to $a$) or $\texttt{y += a}$ (Adds value in $a$ to $y$).
  • Subtraction: Instruction that substracts from any variable a scalar or the value of another variable. Example $\texttt{a -= 1}$ (Subtracts value $1$ from $a$) or $\texttt{v -= u}$ (Subtracts value in $u$ from $v$).
  • Multiplication: Instruction that multiplies a variable by a scalar (multiplying by another variable is not allowed). Example $\texttt{a *= 2}$ (Multiplies $a$ times $2$ and stores the result in $a$).
  • Loop: Block of code that contains the word $\texttt{loop}$ followed by a parameter $\texttt{repeat}$ which is always a scalar in the range $[1, 998244353)$ (variables are not allowed as loops parameters). All the code inside the loop is executed $\texttt{repeat}$ times. Indentation inside loops is using $4$ spaces (see examples for a better understanding of the syntax). Inside every block, there is at least one instruction. Multiple instructions in the same block will have the same indentation. There could be also nested loops.
  • All lines in the program should be valid instructions or loop blocks.
Given a code written in Xela calculate the last value of every variable.

Input

A valid Xela program with at most $100$ lines.

Output

For every variable whose value is different from $0$, print its value in a separate line using the format "$variable = value$" without quotes. Variables must be listed in alphabetical order. If all values are $0$ at the end of the program print "INITIAL STATE" without the quotes.

Sample test(s)

Input
a = 1 b = 1 loop 10 c = a a += b b = c c = 0
Output
a = 144 b = 89
Input
a = 0 loop 100000000 c = 1 d = a a -= c loop 100000000 c *= 2 d += c d *= 3 d -= 1 a += d
Output
a = 916538251 c = 113003797 d = 108226118
Input
x = 17 loop 23 x *= 2 x *= 7 x += 1
Output
INITIAL STATE