#K40112. Evaluate Mathematical Expression

    ID: 26571 Type: Default 1000ms 256MiB

Evaluate Mathematical Expression

Evaluate Mathematical Expression

You are given a string representing a mathematical expression. The expression may contain integer numbers, the operators +, -, *, / and parentheses ( ). Evaluate the expression following the standard operator precedence. If the expression is valid, return the evaluated result. Otherwise, output invalid expression.

For example, the expression 10 + (2 * 3) - 4 is evaluated as
$$10 + (2 \times 3) - 4 = 10 + 6 - 4 = 12.$$

Note: Only integer numbers are allowed, and all evaluations should follow the standard precedence rules.

inputFormat

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

outputFormat

Output a single line: the evaluated result, or invalid expression if the expression is malformed or contains invalid characters.

## sample
2 + 3
5