#include <bits/stdc++.h>
using namespace std;
int tc[4];
set<int>::iterator itr;
;
int ca, cb, cc;
int *p1, *p2, *p3, *pn;
int n, a, b, c;
int r[4005];
int cont1, cont2, cont3;
int maior;
int corta() {
  if (n > 0) {
  }
}
int main() {
  int i, j, k;
  int x, y, z;
  scanf(" %d %d %d %d", &n, &a, &b, &c);
  tc[0] = a;
  tc[1] = b;
  tc[2] = c;
  sort(tc, tc + 3);
  for (i = 0; i < n / a + 1; i++) {
    for (j = 0; j < n / b + 1; j++) {
      int d = n - i * a - j * b;
      if (d % c == 0 && d >= 0) {
        k = d / c;
        maior = max(maior, i + j + k);
      }
    }
  }
  printf("%d", maior);
}
