#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem2219 : THE BYDOLM@STER **/
int C[301], V[301], D[301], L[301];
int dp[301][301];
int M, N;

int solve(int cost, int n, int *t)
{
	if (n==N) {
		return 0;
	}
	
	if (dp[cost][n]>=0)
		return dp[cost][n];
	
	int res=0;
	for (int i=0; cost+i*C[n]<=M; i++) {
		res = max(res, i*t[n]+solve(cost+i*C[n], n+1, t));
	}
	return dp[cost][n] = res;
}

int main()
{
	while (cin>>N>>M) {
		rep(i, N) {
			string s;
			cin.ignore();
			getline(cin, s);
			cin>>C[i]>>V[i]>>D[i]>>L[i];
		}
		int ans = 0;
		memset(dp, -1, sizeof(dp));
		ans = max(ans, solve(0, 0, V));
	
		memset(dp, -1, sizeof(dp));
		ans = max(ans, solve(0, 0, D));
	
		memset(dp, -1, sizeof(dp));
		ans = max(ans, solve(0, 0, L));
	
		cout << ans << endl;
	}
}