#C9852. Total Crystal Power

    ID: 53991 Type: Default 1000ms 256MiB

Total Crystal Power

Total Crystal Power

In a distant land, a curious game is played with magical crystals and spells. Every player starts with a single crystal of power 1. They can cast spells that either increase the power of an existing crystal or summon a new crystal with a specified power.

There are two types of spells:

  • increase i d: Increase the power of the i-th crystal by d.
  • new p: Create a new crystal with power p.

After all spells are cast, calculate the total power of all crystals.

Note: The crystals are 1-indexed. Initially, only one crystal (with power 1) exists.

inputFormat

The input is read from standard input and has the following format:

  1. The first line contains a single integer n (0 ≤ n ≤ 105), representing the number of spells.
  2. The following n lines each contain a spell command. Each command is either:
    • increase i d where i is the 1-indexed crystal to increase and d is the amount to add.
    • new p where p is the power of the new crystal to be added.

outputFormat

Output a single integer representing the total power of all crystals after processing all spells. The output is printed to standard output.

## sample
1
increase 1 3
4

</p>