Expression evaluation is a classic problem. In this problem, you only need to evaluate an expression of length less than

. It only contains non-negative integers (possibly with leading zeros), `+'s, `-'s and `*'s, i.e., it satisfies the following grammar:
<expression>:= <term>|<expression>+<term>|<expression>-<term>
<term>:= <number>|<term>*<number>
<number>:= <digit>|<number><digit>
<digit>:= 0|1|2|3|4|5|6|7|8|9
For example,013, 0213-2132*0213 are valid, but -2132 and 32113+-3213 are invalid.
The result of the evaluation may be too large or negative. Output the result modulo

to avoid overflow since you will use a

-bit machine.
The

-bit machine contains

units of memory, denoted as

,

,

,

. Each unit is a

-bit unsigned number, also an instruction.
In each cycle, let

, the machine execute the instruction

.
Let

at the beginning of cycle, where

,

,

,

are non-negative integers and less than

:
- If
, the machine outputs the value of
and stops. - If
, and then:
– If there are no characters in input left, set

to

;
– Otherwise, set

to the ASCII code of the next character of input, and then set

to

.
- If
, set
to
, and then set
to
. - If
, and then:
– If

, set

to the value of

;
– Otherwise, set

to the value of

.
Note that if

in some instructions,

may be set more than once. Its value is the value set last after the cycle.
You need to set the initial value for each unit such that the machine can stop in finite cycles and output the result of expression modulo

.
Since there is a time limit for a problem. In this problem, the machine can execute at most

cycles.