Bessie has created a new programming language, but without a compiler, she needs your help to run her programs.
COWBASIC is a simple and elegant language with two main operations: addition and loops. To prevent overflow, Bessie performs all addition operations modulo 10^9 + 7. A MOO-loop allows a block of code to be executed a fixed number of times. Both loops and addition operations can be nested.
Your task is to determine the result of executing a given COWBASIC program.
You are given a COWBASIC program consisting of at most lines, with each line containing at most characters.
A COWBASIC program consists of a sequence of statements. There are three types of statements:
<variable> = <expression>
<literal> MOO {
<list of statements>
}
RETURN <variable>An expression can have one of the following three forms:
<literal>
<variable>
(<expression>) + (<expression>)A literal is a positive integer not exceeding 10^5.
A variable is a string of at most lowercase Latin letters.
It is guaranteed that a variable is not used or returned by a RETURN statement before it has been defined. The RETURN statement appears exactly once, on the last line of the program.
Print one positive integer: the value of the variable specified in the RETURN statement.
Example 1