Cossack Vus and Segments
Cossack Vus has discovered segments on a coordinate line. Each segment is defined by two coordinates: as the starting point and as the ending point.
He wants to add two new segments, each of length , in such a way that these two segments do not overlap. Let represent the number of original segments that completely contain the first new segment, and represent the number of original segments that completely contain the second new segment.
Cossack Vus aims to position these two segments to maximize the sum . Your task is to help him determine this maximum value.
Note that a single original segment can completely contain both new segments at the same time.
Note 1. If and () are the starting points of the new segments, then the segments do not overlap if .
Note 2. A new segment starting at is completely contained within an original segment if and .
Input
The first line contains two integers and () — the number of original segments and the length of the new segments.
Each of the following lines contains two integers () — the start and end coordinates of each original segment.
Output
Output a single integer — the maximum possible value of .
Examples
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional constraints.