#include <bits/stdc++.h>
using namespace std;
int func(int n) {
  if (n < 0) {
    return 1;
  } else {
    return n;
  }
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  if (a == 1 || b == 1 || c == 1) {
    cout << n << "\n";
  } else {
    vector<int> v(n + 1);
    int d = min(a, min(b, c));
    for (int i = 0; i < d; i++) {
      if (i == 0) {
        v[i] = 0;
      } else {
        v[i] = -100000;
      }
    }
    for (int i = 1; i <= n; i++) {
      v[i] = 1 + max(v[func(i - a)], max(v[func(i - b)], v[func(i - c)]));
    }
    cout << v[n] << "\n";
  }
}
