Jaroslav owns a small courier service. He has recently got and introduced a new system of processing parcels. Each parcel is a box, the box has its weight and strength. The system works as follows. It originally has an empty platform where you can put boxes by the following rules:
You can take only the topmost box from the platform.
The system receives n parcels, the i-th parcel arrives exactly at time in_{i}, its weight and strength are equal to w_{i} and s_{i}, respectively. Each parcel has a value of v_{i} bourles. However, to obtain this value, the system needs to give the parcel exactly at time out_{i}, otherwise Jaroslav will get 0 bourles for it. Thus, Jaroslav can skip any parcel and not put on the platform, formally deliver it at time in_{i} and not get anything for it.
Any operation in the problem is performed instantly. This means that it is possible to make several operations of receiving and delivering parcels at the same time and in any order.
Please note that the parcel that is delivered at time out_{i}, immediately gets outside of the system, and the following activities taking place at the same time are made without taking it into consideration.
Since the system is very complex, and there are a lot of received parcels, Jaroslav asks you to say what maximum amount of money he can get using his system.
The first line of the input contains two space-separated integers n and S (1 ≤ n ≤ 500, 0 ≤ S ≤ 1000). Then n lines follow, the i-th line contains five space-separated integers: in_{i}, out_{i}, w_{i}, s_{i} and v_{i} (0 ≤ in_{i} < out_{i} < 2n, 0 ≤ w_{i}, s_{i} ≤ 1000, 1 ≤ v_{i} ≤ 10^{6}). It is guaranteed that for any i and j (i ≠ j) either in_{i} ≠ in_{j}, or out_{i} ≠ out_{j}.
Print a single number — the maximum sum in bourles that Jaroslav can get.
3 2
0 1 1 1 1
1 2 1 1 1
0 2 1 1 1
3
5 5
0 6 1 2 1
1 2 1 1 1
1 3 1 1 1
3 6 2 1 2
4 5 1 1 1
5
Note to the second sample (T is the moment in time):
Note that you could have skipped the fourth parcel and got the fifth one instead, but in this case the final sum would be 4 bourles.
Name |
---|