#K8311. Arithmetic Expression Evaluator

    ID: 36125 Type: Default 1000ms 256MiB

Arithmetic Expression Evaluator

Arithmetic Expression Evaluator

You are given a single-line arithmetic expression consisting of non-negative integers and the operators +, -, *, and /. The expression may include spaces and does not contain any parentheses. Your task is to evaluate the expression, obeying the standard operator precedence rules where multiplication and division have higher precedence than addition and subtraction.

In mathematical terms, the operator precedence is given by: $$ \{+, -\}:1, \quad \{*, /\}:2 $$

For example:

  • 3 + 5 * 2 should evaluate to 13.0
  • 10 + 2 * 6 / 3 - 4 should evaluate to 10.0

Output the result as a floating-point number.

inputFormat

The input consists of a single line containing an arithmetic expression. This expression includes non-negative integers, the operators +, -, *, and /, and possibly spaces. There are no parentheses in the expression.

outputFormat

Output a single line that contains the evaluated result of the expression as a floating point number. The result must include a decimal point.

## sample
3 + 5
8.0

</p>