Cliffs#4641

Cliffs

1 second
64 megabytes
Easy

On the planet Olympia, workers are building a new dam. The construction site is a rectangular area on a plane, measuring 1 \times L meters, with coordinates set as shown in the figure.

To raise the terrain, magical impulse generators are employed. If a generator with strength is placed at the -coordinate , then for each point in the segment [p - H\,;\, p] on the axis, the elevation increases by q - p + H meters across the entire width (i.e., for any from to ). Similarly, for each point in the segment [p\,;\, p + H], the elevation increases by H + p - q meters across the entire width. The landscape remains unchanged at other points (see figure). During construction, workers may need to calculate the volume of the dam above a specified rectangle.

Write a program to help the workers with these calculations.

Input

The first line contains two integers: — the number of operations the workers will perform (1 \leq N \leq 100{,}000), and — the length of the rectangle (1 \leq L \leq 100{,}000). The next lines describe the operations: the first number indicates the operation type, where means placing a magical impulse generator, and means querying a volume.

If the operation is , two integers and follow (0 \leq p \leq L;\ 1 \leq H \leq L), indicating a generator with strength is placed at position on the axis.

If the operation is , two integers and follow (0 \leq A < B \leq L), indicating a query for the volume of the dam above the rectangle from to on the axis, and from to on the axis.

Output

For each operation, output a line with the following information. If the operation is , output the number . If the operation is , output the integer part of the volume of the dam above the rectangle from to on the axis, and from to on the axis, as illustrated in the figure.

Examples

Example 1

Loading
Loading