#K71402. Arithmetic Expression Evaluator

    ID: 33523 Type: Default 1000ms 256MiB

Arithmetic Expression Evaluator

Arithmetic Expression Evaluator

You are given a valid arithmetic expression as a string. The expression contains non-negative integers and the operators +, -, *, and /, as well as parentheses ( ). Your task is to evaluate the expression and output the integer result. Note that division between two integers should truncate toward zero (i.e., it behaves like the \(\lfloor x\rfloor\) for positive results and truncates in the direction of zero for negatives).

For example, given the expression 3+5*2, the correct result is 13. Similarly, for the expression (1+2)*3, the result is 9. The expressions will always be valid and the final result will fit within a standard 32-bit signed integer.

inputFormat

The input consists of a single line containing the arithmetic expression as a string.

Input Format:

EXPRESSION

EXPRESSION contains digits (0-9), operators +, -, *, /, and parentheses () with no extra spaces.

outputFormat

Output a single integer, which is the result of evaluating the given arithmetic expression.

Output Format:

RESULT
## sample
3+5*2
13