Lately, Stefan has been interested in studying football statistics and one day, he discovered a new metric called "expected goals" . In order to see how can affect football games, he gathered data from various football games and now he needs your help to process the data he got.
In order to start the research, he told you that there will be events during the football season, and the events are of two types:
: His database gets a scoring chance worth . Since is usually represented as a real number, he gave you its value multiplied by , so that is an integer. Therefore, can be between and , on a probability scale from to (the probability can never be equal to ).
: He wants to find the smallest amount of needed in order for a team to score goals, if we assume that all the scoring chances have been converted into goals.
The database became really big and Stefan got into trouble, so it's up to you to help him!
Input data
The first line of the input contains , the number of queries.
The next lines of the input contain two integers and . For type , is guaranteed to be at most equal to the number of events of type which happened already before the current query.
Output data
The output will contain on each line, the answers for the queries of type , in the order from the input.
Constraints and Clarifications
- ;
- ;
- ;
- ;
- For tests worth points, , .
- For tests worth more points, .
Example 1
stdin
10
1 20
1 8
1 14
1 11
2 3
1 5
1 8
1 11
2 5
2 7
stdout
33
43
77
Explanation
After the first queries, the array is , , , . The smallest amount of we can get from values is obtained by taking , and and the sum is .
After the first queries, the array is , , , , , , . The smallest amount of we can get from values is obtained by taking , , , and and the sum is .
After the first queries, the array is , , , , , , and we have to take every single value, and the sum is .