13872 - Black Box   

Description

On your way to the Delta Building for class as usual, you accidentally tripped. Just when you were angry and wanted to kick the stone that tripped you away, you found that it was not an ordinary stone, but a magical black box.

The box is amazing, you can add or remove some numbers to it, and you can even ask it some questions. 'The box is so cool, if I can make a same one, I can definitely sell it for a lot of money', you think.

You can do five operations to the black box:

  1. 1 k x: add number x into the box k times 
  2. 2 k x: remove number x in the box k times, if number x in box is fewer than k, just remove all x
  3. 3 x: ask how many x are in the box
  4. 4: ask the maximum number in the box, if there are no number in the box, the box will answer you "The box is empty."
  5. 5: ask the minimum number in the box, if there are no number in the box, the box will answer you "The box is empty."

If you want to become rich, please make a same magical black box. 

 

Input

The first line contains an integer N -- the number of operations you will do to the black box.

The next N lines will be the operations as above.

1 <= N <= 2e5.

1 <= k <= 1e9.

-1e9 <= x <= 1e9.

Output

For the third operation, please output how many x are in the box.

For the fourth operation, please output the maximum number in the box, if there are no numbers in the box, output "The box is empty."

For the fifth operation, please output the minimum number in the box, if there are no numbers in the box, output "The box is empty."

Sample Input  Download

Sample Output  Download

Tags




Discuss