Problems
Add subtract and multiply
Add subtract and multiply
Let $x$ be a variable initially equals to $0$. Simulate the next operations with this variable:
\begin{itemize}
\item \textbf{add} $~a$: add value $a$ to $x$;
\item \textbf{subtract} $~a$: subtract value $a$ from $x$;
\item \textbf{multiply} $~a$: multiply $x$ by $a$;
\end{itemize}
\InputFile
Each line contains operation and value. Process all given operations. The value of the variable $x$ after each operation doen not exceed $10^9$ by absolute value.
\OutputFile
Print the resulting value of $x$.
Input example #1
add 2 subtract 5 subtract 1 multiply -3
Output example #1
12
Input example #2
subtract 5 multiply -5 add 5
Output example #2
30