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:
add~a: add value a to x;
subtract~a: subtract value a from x;
multiply~a: multiply x by a;
Input data
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.
Output data
Print the resulting value of x.
Examples
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