#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define MAX 301

int dp[3][MAX][MAX];
int N, M, v[MAX][3], w[MAX];

void solve(){
  for(int k = 0 ; k < 3 ; k++){
    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j <= M ; j++){
	if(j < w[i]) dp[k][i+1][j] = dp[k][i][j];
	else dp[k][i+1][j] = max(dp[k][i][j], dp[k][i+1][j-w[i]] + v[i][k]);
      }
    }
  }
}

int main(){
  string name;
  int V, D, L;
  
  while(cin >> N >> M){
    memset(dp, 0, sizeof(dp));
    for(int i = 0 ; i < N ; i++){
      cin.ignore();
      getline(cin, name);
      cin >> w[i] >> v[i][0] >> v[i][1] >> v[i][2];
    }
    
    solve();
    
    int ans = 0;
    for(int k = 0 ; k < 3 ; k++){
      ans = max(ans, dp[k][N][M]);
    }
    
    cout << ans << endl;
  }
  return 0;
}