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

int main(){

  int n,m;
  int c[301],v[301],d[301],l[301];
  int vdp[301][301];
  int ddp[301][301];
  int ldp[301][301];
  string s;

  while(cin >> n >> m){

    for(int i=0;i<n;i++){
      getline(cin,s);
      getline(cin,s); //なんかエンターキー押した時バグるので重ねて書いた。
      cin >> c[i] >> v[i] >> d[i] >> l[i];
    }

    memset(vdp,0,sizeof(vdp));
    memset(ddp,0,sizeof(ddp));
    memset(ldp,0,sizeof(ldp));

    for(int i=0;i<n;i++){
      for(int j=0;j<=m;j++){
	if(j < c[i]){
	  vdp[i+1][j] = vdp[i][j];
	  ddp[i+1][j] = ddp[i][j];
	  ldp[i+1][j] = ldp[i][j];
	}

	else{
	  vdp[i+1][j] = max(vdp[i+1][j-c[i]]+v[i],vdp[i][j]);
	  ddp[i+1][j] = max(ddp[i+1][j-c[i]]+d[i],ddp[i][j]);
	  ldp[i+1][j] = max(ldp[i+1][j-c[i]]+l[i],ldp[i][j]);
	}

      }
    }

    int ans = max(vdp[n][m],max(ddp[n][m],ldp[n][m]));

    cout << ans << endl;
  }
}