Codeforces Round #416 (Div. 2) has been moved to start on 27.05.2017 09:05 (UTC).
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

The following languages are only available languages for the problems from the contest

Surprise Language Round #6:

- Roco

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

H. Stack

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputIn this problem we'll use a stack which supports two types of operations:

- Push a given number on the stack.
- Pop two numbers from the stack, perform a given operation (addition or multiplication) on them and push the result on the stack.

You are given a string which describes the sequence of operations to be performed on the stack. *i*-th character corresponds to *i*-th operation:

- If
*i*-th character is a digit, push the corresponding number on the stack. - If
*i*-th character is «+» or «*», perform the corresponding operation.

Initially the stack is empty. Output the topmost number on the stack after executing all given operations.

Input

The only line of input contains a string of operations, consisting of characters «+», «*» and digits (0..9). The length of the string will be between 1 and 20 characters, inclusive.

The given sequence of operations is guaranteed to be correct, i.e. the stack will have at least two elements before every math operation. The numbers on the stack will never exceed 10^{6}.

Output

Output a single number — the topmost element of the stack after performing all given operations.

Examples

Input

12+3*66*+

Output

45

Input

149

Output

9

Note

In the first case the stack will end up containing a single number — the result of calculating (1+2)*3+6*6.

In the second case there are no math operations, so the answer will be the last number pushed on the stack.

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/26/2017 06:30:04 (c2).

Desktop version, switch to mobile version.
User lists

Name |
---|