#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 300;
const int MAX_M = 300;

/* typedef */

/* global variables */

int cs[MAX_N], vs[MAX_N], ds[MAX_N], ls[MAX_N];
int dp[2][MAX_M + 1];

/* subroutines */

int n_knapsak(int n, int m, int *cs, int *vs) {
  for (int i = 0; i <= m; i++) dp[0][i] = -1;
  dp[0][0] = 0;
  int cur = 0, nxt = 1;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= m; j++) dp[nxt][j] = dp[cur][j];

    int ci = cs[i], c = ci;
    int vi = vs[i], v = vi;

    while (c <= m) {
      int max_j = m - c;
      for (int j = 0; j <= max_j; j++)
	if (dp[cur][j] >= 0) {
	  int d = dp[cur][j] + v;
	  if (dp[nxt][j + c] < d) dp[nxt][j + c] = d;
	}
      c += ci;
      v += vi;
    }

    cur ^= 1;
    nxt ^= 1;
  }

  int max_d = 0;
  for (int i = 0; i <= m; i++)
    if (max_d < dp[cur][i]) max_d = dp[cur][i];
  
  return max_d;
}

/* main */

int main() {
  for (;;) {
    int n, m;
    cin >> n >> m;
    if (cin.eof()) break;

    for (int i = 0; i < n; i++) {
      while (cin.get() != '\n');
      while (cin.get() != '\n');
      cin >> cs[i] >> vs[i] >> ds[i] >> ls[i];
      //printf("%d %d %d %d\n", cs[i], vs[i], ds[i], ls[i]);
    }

    int nk_v = n_knapsak(n, m, cs, vs);
    int nk_d = n_knapsak(n, m, cs, ds);
    int nk_l = n_knapsak(n, m, cs, ls);

    int max_nk = 0;
    if (max_nk < nk_v) max_nk = nk_v;
    if (max_nk < nk_d) max_nk = nk_d;
    if (max_nk < nk_l) max_nk = nk_l;

    cout << max_nk << endl;
  }

  return 0;
}