#C6139. Evaluate Arithmetic Expression

    ID: 49866 Type: Default 1000ms 256MiB

Evaluate Arithmetic Expression

Evaluate Arithmetic Expression

Given a string representing an arithmetic expression, evaluate it according to the following rules:

  • The expression contains only positive integers.
  • The operators allowed are + and *.
  • Operator Precedence: multiplication has a higher precedence than addition. In other words, the expression is evaluated as if multiplication is done before addition.

Mathematical Formulation: Evaluate the expression $$E = T_1 + T_2 + \cdots + T_k$$ where each term $$T_i = F_{i1} \times F_{i2} \times \cdots \times F_{im}$$, and each factor is a positive integer.

inputFormat

A single line containing the arithmetic expression.

outputFormat

A single integer representing the result of the evaluated expression.

## sample
3+5
8