#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 4e3 + 5;
int f[maxn];
int main() {
  int n, a, b, c, x, y, z;
  cin >> n >> a >> b >> c;
  if (a < b) swap(a, b);
  if (a < c) swap(a, c);
  if (b < c) swap(b, c);
  memset(f, -1, sizeof f);
  f[c] = 1;
  if (b % c == 0)
    f[b] = b / c;
  else
    f[b] = 1;
  if (a % c == 0)
    f[a] = a / c;
  else if (a % b == 0)
    f[a] = a / b;
  else
    f[a] = 1;
  for (int i = 1; i <= n; i++) {
    if (i > c && f[i - c] != -1) f[i] = max(f[i], f[i - c] + 1);
    if (i > b && f[i - b] != -1) f[i] = max(f[i], f[i - b] + 1);
    if (i > a && f[i - a] != -1) f[i] = max(f[i], f[i - a] + 1);
  }
  printf("%d\n", f[n]);
}
