#D3330. The Humans Braving the Invaders

    ID: 2767 Type: Default 2000ms 134MiB

The Humans Braving the Invaders

The Humans Braving the Invaders

Problem

Today, the Earth has been attacked by the invaders from space, Invader, and the only survivors of humankind are us at the base. There is almost no force left to compete with them. But here we do not give up. Eradication of Invaders is the last resort for us humans to survive. I will explain the contents of the strategy that will be the last from now on.

First of all, our strength is too small compared to the strength of the Invader, so we will stay at this base and fight the siege. Surrounded by high mountains, the base has no choice but to take a straight road in front of the base for the invaders to invade. We will call this road a field. With this feature, it is possible to concentrate on the front and attack the invader. At the base, we attack the Invader with two types of weapons. One is a sniper rifle that snipers one invader. The other is a grenade launcher that can attack over a wide area.

As the only programmer in humanity, your job is to simulate combat based on Invaders and our action records. Action records are given in query format. Each query consists of one or more integers and is given as follows:

0 Invaders appear on the field at a distance of L from the base.
1 d All invaders currently on the field approach the base by d. After this action, the invaders that reach the base will take damage, and their enemies will disappear from the field. If it is damaged, "damage (the number of invaders that reached the base at this time)" is output on one line.
2 k If the number of invaders currently on the field is k or more, attack the kth invader from the closest to the base with a sniper rifle. The invader disappears from the field. And output "hit" on one line. If the number of invaders on the field is less than k, print "miss" on one line.
3 x r Attack with a grenade launcher in the range r at a position x from the base. All invaders that land at a distance of x from the base and are less than or equal to r will disappear from the field. Then output "bomb (number of invaders killed)" on one line. As a side note, the base will not be damaged by the grenade launcher.
4 k If the number of invaders on the field is k or more, output "distance (distance between the kth invader from the closest base to the base)" on one line. If the number of invaders on the field is less than k, print "distance -1" on one line.

That is all for the explanation of the strategy. All members start the operation! ... Good luck.

Constraints

The input satisfies the following conditions.

  • All values ​​contained in the input are integers
  • 1 ≤ Q ≤ 100000
  • 1 ≤ L ≤ 109
  • 1 ≤ d, k ≤ 109
  • 0 ≤ x ≤ L
  • 0 ≤ r ≤ 109
  • There can never be more than one invader in the same position
  • No more than 3 datasets

Input

The input consists of multiple datasets. Each dataset is represented below. The first line is given two integers Q and L separated by spaces. The following Q line is given the Q queries described above. The end of the input consists of two zeros.

Output

For each dataset, output for queries that have output instructions. Print "end" at the end of each dataset.

Example

Input

18 10 0 4 1 1 1 4 1 0 1 1 0 2 2 1 10 0 1 1 0 1 1 0 1 5 3 4 0 3 4 1 0 9 10 4 1 2 2 3 5 5 0 4 1 2 2 3 5 5 0 2 1 0 0

Output

distance 10 distance 9 hit damage 2 bomb 1 bomb 2 end distance -1 miss bomb 0 distance 10 miss bomb 1 hit end

inputFormat

outputFormat

output on one line. 2 k | If the number of invaders currently on the field is k or more, attack the kth invader from the closest to the base with a sniper rifle. The invader disappears from the field. And output "hit" on one line. If the number of invaders on the field is less than k, print "miss" on one line. 3 x r | Attack with a grenade launcher in the range r at a position x from the base. All invaders that land at a distance of x from the base and are less than or equal to r will disappear from the field. Then output "bomb (number of invaders killed)" on one line. As a side note, the base will not be damaged by the grenade launcher. 4 k | If the number of invaders on the field is k or more, output "distance (distance between the kth invader from the closest base to the base)" on one line. If the number of invaders on the field is less than k, print "distance -1" on one line.

That is all for the explanation of the strategy. All members start the operation! ... Good luck.

Constraints

The input satisfies the following conditions.

  • All values ​​contained in the input are integers
  • 1 ≤ Q ≤ 100000
  • 1 ≤ L ≤ 109
  • 1 ≤ d, k ≤ 109
  • 0 ≤ x ≤ L
  • 0 ≤ r ≤ 109
  • There can never be more than one invader in the same position
  • No more than 3 datasets

Input

The input consists of multiple datasets. Each dataset is represented below. The first line is given two integers Q and L separated by spaces. The following Q line is given the Q queries described above. The end of the input consists of two zeros.

Output

For each dataset, output for queries that have output instructions. Print "end" at the end of each dataset.

Example

Input

18 10 0 4 1 1 1 4 1 0 1 1 0 2 2 1 10 0 1 1 0 1 1 0 1 5 3 4 0 3 4 1 0 9 10 4 1 2 2 3 5 5 0 4 1 2 2 3 5 5 0 2 1 0 0

Output

distance 10 distance 9 hit damage 2 bomb 1 bomb 2 end distance -1 miss bomb 0 distance 10 miss bomb 1 hit end

样例

18 10
0
4 1
1 1
4 1
0
1 1
0
2 2
1 10
0
1 1
0
1 1
0
1 5
3 4 0
3 4 1
0
9 10
4 1
2 2
3 5 5
0
4 1
2 2
3 5 5
0
2 1
0 0
distance 10

distance 9 hit damage 2 bomb 1 bomb 2 end distance -1 miss bomb 0 distance 10 miss bomb 1 hit end

</p>