PROGRAMMING:The legend of marbles
Now there is a pinball game. The pinball falls from the point whose abscissa is s, and there are n (1 < = n < = 50000) baffles below. The abscissa of the left and right ends are l [i] and R [i] (- 100000 < = l [i] < R [I] < = 100000). The pinball falls on the baffle. You can choose left or right until the pinball falls to the ground and rolls to the end point whose abscissa is zero. Please find out the minimum distance of horizontal movement of the pinball.
###Input format:
Input n and s in the first line, and then input L [i] and R [i] of the baffle from top to bottom
###Output format:
The minimum distance of horizontal movement of output marble
###Input example:
Here is a set of inputs. For example:
```in
4 0
-2 1
-1 2
-3 0
-2 1
```
###Output example:
The corresponding output is given here. For example:
```out
four
```
###Example explanation:
![ QQ screenshot 20200624110156. PNG] (~ / cadd0909-743f-47b9-9716-225830be9c64. PNG)
answer:If there is no answer, please comment
###Input format:
Input n and s in the first line, and then input L [i] and R [i] of the baffle from top to bottom
###Output format:
The minimum distance of horizontal movement of output marble
###Input example:
Here is a set of inputs. For example:
```in
4 0
-2 1
-1 2
-3 0
-2 1
```
###Output example:
The corresponding output is given here. For example:
```out
four
```
###Example explanation:
![ QQ screenshot 20200624110156. PNG] (~ / cadd0909-743f-47b9-9716-225830be9c64. PNG)
answer:If there is no answer, please comment