#C12238. Evaluate Mathematical Expression

    ID: 41643 Type: Default 1000ms 256MiB

Evaluate Mathematical Expression

Evaluate Mathematical Expression

Given a mathematical expression in infix notation, your task is to evaluate the expression and output the result as an integer. The expression contains only non-negative integers and the operators +, -, *, /. Parentheses ( ) may be used to change the order of operations.

Operator precedence is defined as follows:

\( +, - \) have a precedence of \(1\), and \( *, / \) have a precedence of \(2\). The division operator \( / \) represents \( \text{integer division} \), i.e. the fractional part is discarded.

You are required to read the expression from standard input (stdin) and output the evaluated result to standard output (stdout).

inputFormat

The input consists of a single line containing a valid mathematical expression. The expression may include spaces.

Constraints:

  • All numbers are non-negative integers.
  • The expression is guaranteed to be valid.

outputFormat

Output a single integer that is the result of evaluating the given expression using \( \text{integer division} \) for the \( / \) operator.

## sample
42
42