This morning, you woke up and realized that some cats have turned into girls! In light of this exciting event, you have collected a large quantity of catnip to attract girls to your home (it's not as sketchy as it sounds). There, you plan to... take pictures of them while they are in a line. Don't worry, these are harmless pictures! However, your camera is quite small, and you may not be able to capture all of the cat-girls in a single photo. Your camera can only capture a contiguous subsequence of cat-girls in their line-up. Additionally, cat-girls keep showing up during the photo shoot! Even though this is a happy event, it troubles you because you always want to take the best picture you can with the available cat-girls. To complicate things further, some cat-girls want to nap so they leave the photo shoot. Fortunately, you have the cat-girls line up in a line in such a way that cat-girls only arrive and depart from the right end of the line.

Your camera's field of view is units wide. Each cat-girl has two attributes: and . represents the width of the pose the cat-girl is making, in the same units as the field of view of your camera. represents the cuteness of the cat-girl.

The cuteness of a picture is the sum of cuteness values of the cat-girls whose **full poses** are captured in the picture. To satisfy your desires, you write a program to calculate the maximum cuteness you can capture in a photo after each cat-girl arrives. Initially, there are no cat-girls in the line (but don't worry, we assure you that at least one will come!).

#### Input Specification

The first line of input will have , the number of events, and , your camera's field of view, separated by a single space. The next lines will be in one of the following forms:

A cat-girl arrives at the right side of the line with pose width and cuteness . You should output the maximum cuteness of the best picture you can take at this point in time.

Sadly, a cat-girl departs from the right side of the line. Don't worry, she'll surely visit again soon! You can be sure that the line will not be empty when this event happens.

At least 25% of the test cases will have .

#### Output Specification

After each cat-girl's arrival, output the maximum cuteness you can take a photo of.

#### Sample Input 1

```
8 5
A 3 10
A 4 15
D
A 2 9
A 1 10
A 4 15
D
A 6 1000
```

#### Sample Output 1

```
10
15
19
19
25
19
```

#### Sample Input 2

```
5 100
A 100 10000
A 14 28
A 88 166
A 75 39
A 1 1000
```

#### Sample Output 2

```
10000
10000
10000
10000
10000
```

#### Explanation for Sample Output 2

The first cat girl is simply too cute for the others to compete with! Now you have 5 photos of her.

## Comments

more images will definitely help for this problem

I need more pictures to understand the problem. Thanks!

Here ya go

yay, now i'm motivated to do this problem

Alas, I may have these 12 points.

This comment is hidden due to too much negative feedback. Show it anyway.

It clarifies why the cuteness value is .

Exactly. The pictures were very helpful in my attempts to understand the problem.