#C13898. Evaluate Mathematical Expression

    ID: 43486 Type: Default 1000ms 256MiB

Evaluate Mathematical Expression

Evaluate Mathematical Expression

You are given a mathematical expression as a string. The expression contains non-negative integers and the operators +, -, *, and /. Parentheses ( ) may also appear in the expression to override the normal operator precedence. The evaluation must follow the correct order of operations (i.e., the PEMDAS/BODMAS rules).

Note: Division should be performed as integer division (i.e., the result of the division of two integers is truncated towards zero). For instance, the expression
\(100 \times (2+12)/14\)
evaluates to 100.

Read the input from stdin and output the result to stdout.

inputFormat

A single line containing a valid mathematical expression. The expression will contain non-negative integers and the operators +, -, *, and /. Parentheses may be used and the tokens may be separated by spaces.

outputFormat

An integer representing the evaluated result of the expression.## sample

3 + 5
8