#K72582. Evaluate Mathematical Expression

    ID: 33785 Type: Default 1000ms 256MiB

Evaluate Mathematical Expression

Evaluate Mathematical Expression

You are given a string representing a valid arithmetic expression. The expression may contain non‐negative integers, the binary operators +, -, *, /, and parentheses ( ). Your task is to compute the value of the expression by respecting the standard operator precedence and associativity rules.

In mathematical terms, if the given expression is denoted by \(E\), evaluate and output its value where the operations are defined in the usual way. Note that if the expression contains a division operator /, the result should be displayed as a floating point number (for example, 100*(2+12)/14 must result in 100.0). Otherwise, if the result is an integer, output it without a decimal.

inputFormat

The input consists of a single line containing a valid arithmetic expression. The expression can include non-negative integers, operators +, -, *, /, and parentheses. There are no extra characters.

outputFormat

Output the computed value of the expression. If the expression contains a division operator /, the result must be printed as a floating point number (even if the result is mathematically an integer, e.g. print 100.0 instead of 100). Otherwise, print the result as an integer.

## sample
3+5*2
13