No.49 Arithmetic Homework
Problem Statement
Taro is very bad at arithmetic, and he is in trouble because he has been given arithmetic homework.
Today's homework consists of addition and multiplication problems, and it must be finished by tomorrow,
so please solve it in place of the troubled Taro.
In Taro's country, addition is represented by the symbol '*', and multiplication is represented by the symbol '+'.
Also, addition and multiplication have no precedence; calculations are performed in order from left to right.
Input
S
On line \(1\), a string \(S\) representing the expression is given, consisting of at most \(100\) characters.
The string consists only of the characters '0'~'9', '*', and '+'.
It contains no spaces, and a number with 2 or more digits never starts with 0.
Invalid expressions, such as one that starts with an operator or one with 2 consecutive operators, are never given.
Output
Output the value of the calculation result.
The value of the calculation result never exceeds \(10,000\).
Print a newline at the end.
Sample
Sample 1
Input
2*3
Output
5
In Taro's country, the symbol '*' represents addition. Adding \(2\) and \(3\) gives the answer \(5\).
Sample 2
Input
6*7+2
Output
26
In our world's notation this is \(6 + 7 \times 2\), but since there is no precedence, we add \(6\) and \(7\) and then multiply by \(2\).
Sample 3
Input
2497*3+4
Output
10000
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。