Under construction

Still being built. Things may change

Genius mathematician Seongpil

Time limit1sMemory limit128 MB

Summary
Evaluate a postfix expression of single digits and the operators +, -, *, / with no spaces.
Level

Medium4 of 10

Topics
Stack, Implementation
Solved
No attempts yet

Problem

Seongpil in a parallel world is the leading mathematician of his time, and he invented the digits and operators. Their shapes match the ones in daily use, but the notation differs. In his world an operator follows its operands.

Conversion from ordinary notation to his notation works in two passes. First, add parentheses around the expression according to operator precedence. Then move each parenthesized operator to the right of its closing parenthesis.

For example, a+b∗ca+b*c groups as (a+(b∗c))(a+(b*c)) under precedence. Moving the inner ∗* out gives a+bc∗a+bc*, and moving ++ gives abc∗+abc*+.

His world has no programming language, so write a program that evaluates his notation in his place.

Input

One expression of length at most 100100 is given on one line with no spaces. It contains only single digits from 00 to 99 and the operators ++, −-, ∗*, //.

Every intermediate result is an integer that does not exceed 21474836472147483647. No division by zero occurs.

The input is always a valid expression.

Output

Print the value of the given expression on the first line.

Examples1

  1. Example 1

    Input
    123*+
    
    Expected output
    7