Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/case-ikki-amalli-ifoda

Expression with two operations

Medium 1000 ms 64 MB 42%
Share

An expression of the form $a \ o_{1} \ b \ o_{2} \ c$ is given, where $o_{1}$ and $o_{2}$ are the operations +, - or *. Compute its value by the rules of mathematics: multiplication is done before addition and subtraction, and operations of the same level are done from left to right.

The precedence of multiplication over addition

Input

One line with five items separated by spaces: an integer $a$, an operation sign $o_{1}$, an integer $b$, an operation sign $o_{2}$, an integer $c$. The minus of a negative number is written without a space (for example, -5 * -6 - 7).

Output

One integer — the value of the expression.

Note

$-1000 \le a, b, c \le 1000$
$o_{1}$, $o_{2}$ are +, - or *

Examples

Input #1
2 + 3 * 4
Output #1
14
Input #2
10 - 4 - 3
Output #2
3

Sign in to submit a solution

Signing up is free and takes a minute.