#K57632. Evaluate Arithmetic Expression

    ID: 30464 Type: Default 1000ms 256MiB

Evaluate Arithmetic Expression

Evaluate Arithmetic Expression

You are given a mathematical expression as a string that consists of non-negative integers and the operators +, -, *, and /. The expression should be evaluated in the standard order of operations (multiplication and division are evaluated before addition and subtraction). Note that division is defined as integer division which truncates towards zero. For example, the expression 3+2*2 is evaluated as 3 + (2 * 2) = 7.

The allowed operators and their meanings in LaTeX are as follows:

  • Addition: $+$
  • Subtraction: $-$
  • Multiplication: $\times$ or $\cdot$
  • Division: $/$ (integer division truncates towards zero)

Your task is to implement a program that reads an arithmetic expression from standard input and prints the evaluated integer result to standard output.

inputFormat

The input consists of a single line containing a string that represents the arithmetic expression. The expression contains non-negative integers and the operators +, -, *, and / without any spaces.

outputFormat

Output a single integer which is the result of evaluating the given expression.

## sample
3+2*2
7