#K12181. Robot Final Score Calculator

    ID: 23634 Type: Default 1000ms 256MiB

Robot Final Score Calculator

Robot Final Score Calculator

In this problem, a robot performs a series of operations to compute a final score. Initially, the robot's score is (0). The robot may receive one of two types of operations: add and set. When an add operation is performed with a value (v), it adds (v) to the current score, i.e., (score = score + v). When a set operation is performed with a value (v), it resets the score to (v), i.e., (score = v).

The operations are applied in the order they are given. Your task is to compute and print the final score of the robot after executing all the operations.

inputFormat

The input is read from stdin and consists of multiple lines. The first line contains an integer (n) indicating the number of operations. Each of the next (n) lines contains an operation formatted as: operation value, where operation is either add or set, and value is an integer.

outputFormat

Print the final score of the robot to stdout.## sample

5
add 10
add 15
set 20
add 5
set 30
30

</p>