#C12354. Basic Expression Calculator

    ID: 41772 Type: Default 1000ms 256MiB

Basic Expression Calculator

Basic Expression Calculator

You are given a mathematical expression as a string. The expression contains non-negative integers, the operators +, -, *, /, and may include parentheses ( and ). Your task is to evaluate the expression according to standard operator precedence rules. The division operator performs integer division, truncating toward zero.

In mathematical terms, given an expression \(E\), you are to compute \(\text{result} = E\). For instance, the expression 2 + 3 * 4 should be evaluated as \(2 + (3 \times 4) = 14\).

inputFormat

The input consists of a single line containing a valid mathematical expression. The expression may include spaces, digits, the operators +, -, *, /, and parentheses.

outputFormat

Output a single integer representing the evaluated result of the expression. Note that division should truncate toward zero.

## sample
1 + 1
2