Furiosa AI is developing a Neural Processing Unit (NPU) that can perform artificial intelligence model training and inference faster than existing processing units. Programs running on a general processing unit process data stored in a host using various types of operators to calculate desired values. In this problem, we simplify this process and consider the following environment:
- The host has space to store $1\,000\,000$ pieces of data, and each space is numbered from $0$ to $999\,999$.
- Each operator takes one or more input data and calculates one output data. Operators are also numbered from $0$ to $999\,999$.
A program is expressed in the following BNF (Backus-Naur Form):
<number> ::= 0 | 1 | ... | 999999<value> ::= <number> | <number>(<list>)<list> ::= <value> | <list>,<value>A program calculates a single value. That is, a program is a string corresponding to a
<value>.- The value of a
<value>is calculated as follows:- If
<value>is expressed as<number>, it is the data stored in the host's<number>space before the program starts. - If
<value>is expressed as<number>(<list>), it is the output data calculated using the<number>operator, taking the<value>s in the<list>as input data in order.
- If
- The same
<number>does not appear multiple times in a single program.
The NPU developed by Furiosa AI can execute the same program faster than a general processing unit, but this requires a compiler to recompile the program into low-level instructions used by the NPU. Since the memory usage and execution time of a program change depending on how it is compiled, an optimized compiler is needed to use the NPU efficiently.
The NPU has memory that can store $M$ pieces of data, and each space in the memory is numbered from $0$ to $M-1$. The NPU supports the following three types of instructions:
a >> b- Copies the data at host address
ato memory addressb. ($0 \le a < 1\,000\,000$; $0 \le b < M$) If data already exists, it is overwritten.
- Copies the data at host address
a << b- Copies the data at memory address
bto host addressa. ($0 \le a < 1\,000\,000$; $0 \le b < M$) If data already exists, it is overwritten.
- Copies the data at memory address
o = w | m1 m2 ··· ml- Stores the output data of operator
w, which takes the values at memory addressesm1, m2, ..., mlas input data in order, into memory addresso. - The space where the output data is stored must be different from the spaces where the input data is stored. That is, $o \neq m_i$ ($1 \le i \le l$) must hold.
- Stores the output data of operator
An NPU program is a sequence of the above instructions, and when the program is executed, the instructions constituting the program are executed in order.
The efficiency of a program is determined by various factors, but if the number of instructions used is small, it is likely to be an efficient program. Given a string corresponding to a <value>, let's convert it into an NPU program that calculates the value of <value> and stores it in memory address $0$ using as few instructions as possible.
Input
The first line contains the size $M$ of the NPU's memory. ($1 \le M \le 1\,000\,000$)
The second line contains the string corresponding to the <value> to be calculated. The length of this string is $1\,000\,000$ or less.
Output
If the program cannot be compiled due to insufficient NPU memory, output $-1$.
If the program can be compiled, output the number of instructions in the program that calculates the <value> using the minimum number of instructions on the first line. From the next line, output the instructions constituting the program one by one in order. There is one space between all tokens of an instruction.
If there are multiple possible answers, output any one of them.
Examples
Input 1
7 71(72(41,42),73(43,44))
Output 1
7 41 >> 3 42 >> 4 43 >> 5 44 >> 6 1 = 72 | 3 4 2 = 73 | 5 6 0 = 71 | 1 2
Input 2
3 71(72(41,42),73(43,44))
Output 2
9 43 >> 2 44 >> 0 1 = 73 | 2 0 59 << 1 41 >> 2 42 >> 0 1 = 72 | 2 0 59 >> 2 0 = 71 | 1 2
Input 3
2 71(72(41,42),73(43,44))
Output 3
-1