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

int C[MAX],V[MAX],D[MAX],L[MAX];
int n,cost;
int dp[MAX][MAX];


int recv(int i,int j){
  if(dp[i][j] != -1) return dp[i][j]; 
  if(i == n )return 0;
  int res =0;
  //if(j < C[i])return recv(i+1,j);
  //else{
    for(int k=0;k*C[i]<=j;k++){
      res = max(res,k*V[i]+recv(i+1,j-k*C[i]));
    }
    //}
  
  return dp[i][j]=res;
}
int recd(int i,int j){
  if(dp[i][j] != -1) return dp[i][j]; 
  if(i == n )return 0;
  int res =0;
  //if(j < C[i])return recd(i+1,j);
  //else{
    for(int k=0;k*C[i]<=j;k++){
      res = max(res,k*D[i]+recd(i+1,j-k*C[i]));
    }
    //}
  
  return dp[i][j]=res;
}
int recl(int i,int j){
  if(dp[i][j] != -1) return dp[i][j]; 
  if(i == n )return 0;
  int res =0;
  //if(j < C[i])return recl(i+1,j);
  //else{
    for(int k=0;k*C[i]<=j;k++){
      res = max(res,k*L[i]+recl(i+1,j-k*C[i]));
    }
    //}
  
  return dp[i][j]=res;
}



int main(){

  int iori,chihaya=0,makoto=0,miki=0;


  while( cin >> n >> cost ){

    for(int i=0;i<n;i++){
      char ch = getchar();
      while((ch=getchar())!='\n');
      cin >> C[i] >> V[i] >> D[i] >> L[i];
    }

    memset(dp,-1,sizeof(dp));
    chihaya = (chihaya,recv(0,cost));
    //cout << "DEBUG V = " << chihaya << endl;
    /*
    for(int i=0;i < 10;i++){
      for(int j=0;j<10;j++)cout << dp[i][j] << " " ;
      cout << endl; 
    }
    */
    memset(dp,-1,sizeof(dp));
    makoto = recd(0,cost);
    //cout << "DEBUG D = " << makoto << endl;
    memset(dp,-1,sizeof(dp));
    miki = recl(0,cost);
    //  cout << "DEBUG L = " << miki << endl;

    iori=max(chihaya,max(makoto,miki));

    cout << iori << endl;

  }
  return 0;
}