cho.sh
Notes
Loading...

Large Number Calculation

Time limit

2s

Memory limit

128 MB

Problem

You are given an expression made of integers and operators. The expression has no parentheses. Evaluate multiplication and division before addition and subtraction. Operators with the same precedence are evaluated from left to right.

The absolute value of each integer is at most 10^100. If a division result is not an integer, round it down. This also means a negative non-integer result is rounded toward the smaller integer.

Input

The first line contains the number of integers N (1 <= N <= 10).

The next 2N - 1 lines contain integers and operators (+, -, *, /) in alternating order. The first and last of these lines are integers, and each operator appears between two integers.

Output

Print the integer result after evaluating the expression.