#include <bits/stdc++.h>
const int N = 100000;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int v, w[N], f[N];
int max(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
int main() {
  v = read();
  for (int i = 1; i <= 3; i++) w[i] = read();
  memset(f, -1, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= 3; i++) {
    for (int j = w[i]; j <= v; j++) {
      if (f[j - w[i]] != -1) f[j] = max(f[j], f[j - w[i]] + 1);
    }
  }
  printf("%d", f[v]);
}
