int n, x, y, z;
int dp[10055];
int rec(int at) {
if(at == 0) {
return 0;
}
if(dp[at] != -1) {
return dp[at];
}
int res = -2e7;
if(at - x >= 0) {
res = max(res, rec(at - x) + 1);
}
if(at - y >= 0) {
res = max(res, rec(at - y) + 1);
}
if(at - z >= 0) {
res = max(res, rec(at - z) + 1);
}
return dp[at] = res;
}
int maximizeTheCuts(int n, int x, int y, int z)
{
this->n = n;
this->x = x;
this->y = y;
this->z = z;
memset(dp, -1, sizeof dp);
return rec(n) > 0 ? rec(n) : 0;
}