#include <bits/stdc++.h>
using namespace std;
long long getCount(long long n, long long a, long long b, long long c,
                   long long mem[]) {
  mem[0] = 0;
  for (long long i = a; i <= n; i += a) {
    mem[i] = i / a;
  }
  for (long long i = b; i <= n; i += 1) {
    if (mem[i] == -1) {
      if (mem[i - b] != -1) {
        mem[i] = mem[i - b] + 1;
      }
    }
  }
  for (long long i = c; i <= n; i += 1) {
    if (mem[i - c] != -1) {
      if (mem[i] != -1)
        mem[i] = max(mem[i], mem[i - c] + 1);
      else
        mem[i] = mem[i - c] + 1;
    }
  }
  return mem[n];
}
int main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  long long* mem = new long long[n + 1];
  if (a > b) swap(a, b);
  if (b > c) swap(b, c);
  if (a > b) swap(a, b);
  std::fill(mem, mem + n + 1, -1);
  cout << getCount(n, a, b, c, mem) << endl;
}
