#K77567. Evaluate Mathematical Expression

    ID: 34893 Type: Default 1000ms 256MiB

Evaluate Mathematical Expression

Evaluate Mathematical Expression

You are given a valid mathematical expression consisting of integers, the operators +, -, *, and /, and parentheses. Your task is to evaluate the expression and output the integer result.

Note:

  • The division operator / represents integer division. For example, \(\frac{7}{2}\) evaluates to 3.
  • Operator precedence follows the standard rules: parentheses have the highest precedence, multiplication and division come next, and addition and subtraction are evaluated last. That is, \( (a+b)*c \neq a+(b*c) \) in general.

The expression is guaranteed to be valid and will not result in division by zero.

inputFormat

The input consists of a single line containing a valid mathematical expression as described.

Example:

3+5*2-9/3

outputFormat

Output a single integer: the result of evaluating the given expression.

Example:

10
## sample
2+3
5