Time Limit:1000ms Memory Limit:65536KB

## Description

```Baihacker develops a Script Language, which is used to complete simple calculating.
The grammar of this language is as follow:

Grammar Table
Primary expression:
Number
Variable-Name
Function-Name
(Expression)

Postfix expression:
Primary expression
Postfix expression (Expression-List)
Postfix expression !

Unary expression:
Postfix expression
~ Unary expression
+ Unary expression
- Unary expression

Multiplicative expression:
Unary expression
Multiplicative expression * Unary expression
Multiplicative expression / Unary expression

Multiplicative expression
Additive expression + Multiplicative expression
Additive expression - Multiplicative expression

Shift expression:
Shift expression << Additive expression
Shift expression >> Additive expression

Relational expression:
Shift expression
Relational expression > Shift expression
Relational expression >= Shift expression
Relational expression < Shift expression
Relational expression <= Shift expression

Equality expression:
Relational expression
Equality expression == Relational expression
Equality expression != Relational expression

And expression:
Relational expression
And expression & Relational expression

Xor expression:
And expression
Xor expression ^ And expression

Or expression:
Xor expression
Or expression | Xor expression

Assignment expression:
Or expression
Or expression = Assignment expression

Expression:
Assignment expression
Empty Expression

Expression-List:
Expression
Expression-List, Expression

Statement:
Expression;

Statement-List:
Statement
Statement-List Statement

Programme:
begin
Statement-List
end

1.Empty Expression means a empty string;
2.A number is a sequence of digitals and is always a decimal number.A number is
always positive and you
3.A variable name or a function name is consiste of letters, case-sensitive, and
the length is no more than 32.
4.Neither a variable name nor a function name will be begin or end.
5.Signed 32-bit operations.
6.The priority of operator, the group order can be found in the grammar list.
7.The ! means factorial, and the other operator are the same as the C++'s.
8.The variables can be declared implicit, and initialized with 0.
9.The value of relational expression and equality expression is converted to 1
or 0.When the result is true, the value is 1, otherwise 0.
10.Free-style.Spaces can occur freely.A statement can be written in mutiple lines.
The name, number shouldn't be seperated by space or new line.
11.Function list:

max(Expression-List)
Find the maximum value of its epression list, evaluate from left to right.
When the expression list is empty, the value is 0.

min(Expression-List)
Find the minimum value of its epression list, evaluate from left to right.
When the expression list is empty, the value is 0.

sum(Expression-List)
Calculate the sum of its epression list, evaluate from left to right. When
the expression list is empty, the value is 0.

input(Expression-List)
The expression list should be a list of variable name, input the variables
from left to right. The value of the whole expression is the number of variables
it inputs.

print(Expression-List)
Print the value of each expression from left to right in a single line, when the
list is empty, just output a empty line.The value of the whole expression is the
number of expressions it prints.

while (expression1, expression2)
While the value of expression1 is not zero, evaluate expression2. The value of
the whole expression is the value when evaluating expression2 the last time.I
expression2 is never evaluated, the value is 0.

select(expression1, expression2, expression3)
Evaluate expression1 first, if the value is non-zero then evaluate expression2
and the value of the whole expression is the value of expression2, otherwise
evaluate expression3 and the value of the whole expression is the value of
expression3.

sequence()
Evalute the expression list from left to right, and the value of the whole
expression is the value of the last expression of the expression list.If the list
is empty, the value is 0.

Now, Baihacker wants to write a programme to explain this language, can you help him?
```

## Input

```Single test case.
The first is an integer N, then the next line has N integers seperated by a space.
These integers are the possible input of the programme you will simulate.
Then a valid programme of the Script Language follows.
We guarantee there is no division.
We guarantee there is no overfolow when you calculate correctly.
We guarantee N is always equal or more than the input the programme required when
it runs correctly.
The right operand of shift operator is between 0 and 31.
```

## Output

```The output of the language.
```

## Sample Input

```1
2
begin
print(input(Baihacker));
print(Baihacker);
print(print(331012005),print());
end
```

```1
2
331012005
1

0
```

Baihacker

Final (Single)