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: 

  * If the platform is empty, then the box is put directly on the platform, otherwise it is put on the topmost box on the platform. 
  * The total weight of all boxes on the platform cannot exceed the strength of platform S at any time. 
  * The strength of any box of the platform at any time must be no less than the total weight of the boxes that stand above. 



You can take only the topmost box from the platform.

The system receives n parcels, the i-th parcel arrives exactly at time ini, its weight and strength are equal to wi and si, respectively. Each parcel has a value of vi bourles. However, to obtain this value, the system needs to give the parcel exactly at time outi, 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 ini 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 outi, 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.

Input

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: ini, outi, wi, si and vi (0 ≤ ini < outi < 2n, 0 ≤ wi, si ≤ 1000, 1 ≤ vi ≤ 106). It is guaranteed that for any i and j (i ≠ j) either ini ≠ inj, or outi ≠ outj.

Output

Print a single number — the maximum sum in bourles that Jaroslav can get.

Examples

Input

3 2
0 1 1 1 1
1 2 1 1 1
0 2 1 1 1


Output

3


Input

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


Output

5

Note

Note to the second sample (T is the moment in time): 

  * T = 0: The first parcel arrives, we put in on the first platform. 
  * T = 1: The second and third parcels arrive, we put the third one on the current top (i.e. first) parcel on the platform, then we put the secod one on the third one. Now the first parcel holds weight w2 + w3 = 2 and the third parcel holds w2 = 1. 
  * T = 2: We deliver the second parcel and get v2 = 1 bourle. Now the first parcel holds weight w3 = 1, the third one holds 0. 
  * T = 3: The fourth parcel comes. First we give the third parcel and get v3 = 1 bourle. Now the first parcel holds weight 0. We put the fourth parcel on it — the first one holds w4 = 2. 
  * T = 4: The fifth parcel comes. We cannot put it on the top parcel of the platform as in that case the first parcel will carry weight w4 + w5 = 3, that exceed its strength s1 = 2, that's unacceptable. We skip the fifth parcel and get nothing for it. 
  * T = 5: Nothing happens. 
  * T = 6: We deliver the fourth, then the first parcel and get v1 + v4 = 3 bourles for them. 



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.
#include <bits/stdc++.h>
using namespace std;
const int md = 1000000007;
const int maxn = 1100;
const long long inf = 2020202020202020202LL;
struct box {
  int in, out, w, s, v;
};
int dp[1100][1100], n, s, subdp[1100];
vector<box> nice;
bool cmp(const box& a, const box& b) {
  return a.in < b.in || a.in == b.in && a.out > b.out;
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    box j;
    cin >> j.in >> j.out >> j.w >> j.s >> j.v;
    j.in++;
    j.out++;
    nice.push_back(j);
  }
  box jj = {0, 1002, 0, s, md};
  nice.push_back(jj);
  sort(nice.begin(), nice.end(), &cmp);
  for (int i = n; i >= 0; i--) {
    for (int pr = 0; pr < s + 1; pr++) {
      int prn = min(nice[i].s, pr - nice[i].w);
      if (prn >= 0) dp[i][pr] += nice[i].v;
      if (prn >= 0) {
        for (int it = nice[i].in; it <= nice[i].out; it++) subdp[it] = 0;
        int curr = 0;
        for (int u = n; u > i; u--) {
          if ((nice[i].in <= nice[u].in) && (nice[i].out >= nice[u].out)) {
            int x = subdp[nice[u].out] + dp[u][prn];
            if (x > curr) curr = x;
            subdp[nice[u].in] = curr;
          }
          int y = nice[u].in;
          while (nice[u - 1].in <= y) {
            subdp[y] = curr;
            y--;
          }
        }
        dp[i][pr] += subdp[nice[i].in];
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < s + 1; i++) ans = max(ans, dp[0][i]);
  cout << ans - md;
  return 0;
}
