e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Week 6: December 14 - 20. Char arrays 1

Add subtract and multiply

Let x is 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

Each line contains operation and value. Process all given operations. The value of the variable x after each operation doen not exceed 109 by absolute value.

Output

Print the resulting value of x.

Time limit 1 second
Memory limit 128 MiB
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