Starting from:

$30

Hijacking the fees

Hijacking the fees
The board of directors are very impatient. It has been 5 days since the company restarted and the
economy has not collapsed into itself. This suggests that the finance department needs to be sacked and
has been thrown into the fourth closest sun.
The board has decided to increase the fees for the parks by at least 4 million altairian dollars. Some
others think it might be better to increase each park individually and there are some who think it might
be better to increase the fees of multiple parks at the same time. The finer points are still under scrutiny
whereas the chairman is nowhere to be found after he went to take a stroll in the park.
They have decided that you, having helped implement the database in the first place, would be a good
choice as a programmer to do the updates in the system.
There will be three types of queries to the database
insert a planet with name and entrance fee into the database
increase the entrance fee for all planets between by
return the entrance fee for a planet name from the database
Input Format
The first line contains the number of queries to be made to the database.
The next lines contain queries of the following 3 types
, insert a planet with name and entrance fee into the database
, increase the entrance fee for all planets between by
, return the entrance fee for a planet name from the database
Constraints
Output Format
For each query of type print the entrance fee of the planet in a new line.
Sample Input 0
7
1 earth 10
1 venus 30
1 jupiter 5
2 earth venus 10
3 earth
3 venus
3 jupiter
Sample Output 0
20
40
15
Sample Input 1
7
1 earth 10
1 venus 30
2 earth venus 10
1 jupiter 5
3 earth
3 venus
3 jupiter
Sample Output 1
20
40
5
Sample Input 2
8
1 earth 10
1 venus 30
1 jupiter 5
2 z a 10
3 earth
3 venus
3 jupiter
3 mars
Sample Output 2
20
40
15
-1

More products